From what you showed me,
int main(int argc, char **argv)
{
QtSingleApplication app(argc, argv);
if (app.isRunning())
{
app.show(); //THIS CAN'T BE DONE
return 0;
}
MyMainWidget mmw;
app.setActivationWindow(&mmw);
mmw.show();
return app.exec();
}
int main(int argc, char **argv)
{
QtSingleApplication app(argc, argv);
if (app.isRunning())
{
app.show(); //THIS CAN'T BE DONE
return 0;
}
MyMainWidget mmw;
app.setActivationWindow(&mmw);
mmw.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
This is what I currently have tried. What happens is that a second instance of the application appears for a short second then disappears
My Main.CPP
int main(int argc, char **argv)
{
QtSingleApplication app(argc,argv)
MainWindow w;
if (app.isRunning())
{
w.show(); //MAYBE I SHOULD TRY THIS? DOESN'T DO WHAT I WANT
//app.show();
return 0;
}
Q_INIT_RESOURCE(tray);
QObject::tr("I couldn't detect any system tray on this system."));
return 1;
}
//MainWindow w;
app.setActivationWindow(&w);
w.hide();
return app.exec();
}
int main(int argc, char **argv)
{
QtSingleApplication app(argc,argv)
MainWindow w;
if (app.isRunning())
{
w.show(); //MAYBE I SHOULD TRY THIS? DOESN'T DO WHAT I WANT
//app.show();
return 0;
}
Q_INIT_RESOURCE(tray);
if (!QSystemTrayIcon::isSystemTrayAvailable()) {
QMessageBox::critical(0, QObject::tr("Systray"),
QObject::tr("I couldn't detect any system tray on this system."));
return 1;
}
QApplication::setQuitOnLastWindowClosed(false);
//MainWindow w;
app.setActivationWindow(&w);
w.hide();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
External program calling
s << "C:\\PATH.EXE;
QProcess process(s);
process.start();
QStringList s;
s << "C:\\PATH.EXE;
QProcess process(s);
process.start();
To copy to clipboard, switch view to plain text mode
Bookmarks