Add singleapplication

This commit is contained in:
Kevin Yue
2020-02-15 16:42:20 +08:00
parent 321c73710e
commit b6f499dde5
5 changed files with 13 additions and 4 deletions

Binary file not shown.

View File

@@ -4,6 +4,9 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
include(../singleapplication/singleapplication.pri)
DEFINES += QAPPLICATION_CLASS=QApplication
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the

View File

@@ -1,11 +1,13 @@
#include "singleapplication.h"
#include "gpclient.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
SingleApplication app(argc, argv);
GPClient w;
w.show();
return a.exec();
QObject::connect(&app, &SingleApplication::instanceStarted, &w, &GPClient::raise);
return app.exec();
}