// Single instance int main(int argc, char **argv) { QtSingleApplication app(argc, argv); if (app.isRunning()) return 0; MyMainWidget mmw; app.setActivationWindow(&mmw); mmw.show(); return app.exec(); }
// Single instance int main(int argc, char **argv) { QtSingleApplication app(argc, argv); QMainWindow mw; if (app.isRunning()) { mw.setDestPath(argv[1]); // обновили путь return 0; // вышли } app.setActivationWindow(&mw); mw.show(); return app.exec(); }
C++ (Qt)connect(this, SIGNAL(messageReceived(const QString &)), SLOT(setDestPath(const QString &)));
C++ (Qt)QObject::connect(&app, SIGNAL(messageReceived(const QString &)), &mw, SLOT(setDestPath(const QString &)));
C++ (Qt)while(!asleep()) sheep++;
qtsingleapplication.h:47: ошибка: QtGui/QApplication: No such file or directoryqtlocalpeer.h:48: ошибка: QtNetwork/QLocalServer: No such file or directoryqtlockedfile.h:50: ошибка: QtCore/QFile: No such file or directory