ich habe einen QDialog und erstelle ein Tray-Icon mit QSystemTrayIcon. Da ich das Dialog-Fenster erst mal nicht brauche, habe ich in der main.cpp w.show(); auskommentiert:
Code: Alles auswählen
QApplication a(argc, argv);
Dialog w;
//w.show();
return a.exec();Code: Alles auswählen
statusAction = new QAction(tr("&Status"), this);
statusAction->setIcon(QIcon(":/dialog-information.png"));
connect(statusAction, SIGNAL(triggered()), this, SLOT(showStatus()));Code: Alles auswählen
void Dialog::showStatus()
{
msg("Windows will shut down after the following process ends:\nvlc.exe", "Status");
}Code: Alles auswählen
void Dialog::msg(QString text, QString title)
{
// Objekt wird im Konstruktor erstellt
// this->msgBox = new QMessageBox(this);
this->msgBox->setText(text);
this->msgBox->setWindowTitle(title);
this->msgBox->setIcon(QMessageBox::Information);
this->msgBox->exec();
}Wieso beendet sich das Programm nach der MsgBox?
Gibts eine bessere Methode für ein "Nur-Tray-App"?
Danke
PS: Verwende den QTCreator.