Fix application auto close bug. This happens on Windows and i3wm (no

other are known). But why only them? God knows..
This commit is contained in:
ArsenArsen 2017-05-24 16:51:14 +02:00
parent 4150551d78
commit 24e186e73b
3 changed files with 9 additions and 3 deletions

View File

@ -6,7 +6,8 @@
#include <QGraphicsTextItem>
#include <QTimer>
ColorPickerScene::ColorPickerScene(QPixmap *pixmap, QWidget *parentWidget) : QGraphicsScene(), QGraphicsView(this, parentWidget) {
ColorPickerScene::ColorPickerScene(QPixmap *pixmap, QWidget *parentWidget)
: QGraphicsScene(), QGraphicsView(this, parentWidget) {
setFrameShape(QFrame::NoFrame); // Time taken to solve: A george99g and 38 minutes.
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

View File

@ -1,4 +1,5 @@
#include "mainwindow.hpp"
#include "screenshotutil.hpp"
#include <QApplication>
#include <QCommandLineParser>
#include <QtGlobal>
@ -32,6 +33,7 @@ void handler(QtMsgType type, const QMessageLogContext &, const QString &msg) {
int main(int argc, char *argv[]) {
qInstallMessageHandler(handler);
QApplication a(argc, argv);
a.setQuitOnLastWindowClosed(false);
a.setApplicationName("KShare");
a.setOrganizationName("ArsenArsen");
a.setApplicationVersion("3.0");

View File

@ -39,6 +39,7 @@ CustomUploader::CustomUploader(QString absFilePath) {
if (!obj["desc"].isString())
/*t*/ error(absFilePath, "desc not a string");
else
desc = obj["desc"].toString();
} else
desc = absFilePath;
@ -78,7 +79,8 @@ CustomUploader::CustomUploader(QString absFilePath) {
error(absFilePath, "imageformat not string");
}
QString imageFormat = imageValue.toString();
if (imageFormat == "base64" || QRegExp("base64\\([^+]+\\+[^+]+)").exactMatch(imageFormat) || QRegExp("[^+]+\\+[^+]+").exactMatch(imageFormat)) {
if (imageFormat == "base64" || QRegExp("base64\\([^+]+\\+[^+]+)").exactMatch(imageFormat)
|| QRegExp("[^+]+\\+[^+]+").exactMatch(imageFormat)) {
this->iFormat = imageFormat;
} else
error(absFilePath, "imageformat invalid");
@ -230,7 +232,8 @@ void parseResult(QJsonDocument result, QByteArray data, QString returnPathspec,
} else
notifications::notify("KShare Custom Uploader " + name, "Upload done, but result empty!");
} else {
notifications::notify("KShare Custom Uploader " + name, "Upload done, but result is not JSON Object! Result in clipboard.");
notifications::notify("KShare Custom Uploader " + name,
"Upload done, but result is not JSON Object! Result in clipboard.");
QApplication::clipboard()->setText(data);
}
}