Hi.
The story: my app got tray icon with menu attached, there's a point in menu called Configure that raises non-modal dialog. If i press Ok or Cancel in dialog application exits.
No error messages or at least info, it just exits.
The code:
Handler:
void AppMainWindow::config() {
if(!conf_dialog)
conf_dialog=new ConfigDlg(this);
conf_dialog->show();
conf_dialog->raise();
conf_dialog->activateWindow();
}
void AppMainWindow::config() {
if(!conf_dialog)
conf_dialog=new ConfigDlg(this);
conf_dialog->show();
conf_dialog->raise();
conf_dialog->activateWindow();
}
To copy to clipboard, switch view to plain text mode
Action creation:
configAction
=new QAction(tr
("&Configure..."),
this);
configAction->setStatusTip(tr("Displays configuration menu."));
connect(configAction,SIGNAL(triggered()),this,SLOT(config()));
configAction=new QAction(tr("&Configure..."),this);
configAction->setStatusTip(tr("Displays configuration menu."));
connect(configAction,SIGNAL(triggered()),this,SLOT(config()));
To copy to clipboard, switch view to plain text mode
Menu creation:
trayMenu
=new QMenu(this);
trayMenu->addAction(showAction);
trayMenu->addAction(configAction);
trayMenu->addSeparator();
trayMenu->addAction(exitAction);
trayMenu=new QMenu(this);
trayMenu->addAction(showAction);
trayMenu->addAction(configAction);
trayMenu->addSeparator();
trayMenu->addAction(exitAction);
To copy to clipboard, switch view to plain text mode
Tray icon creation:
tray->setContextMenu(trayMenu);
tray->show();
tray=new QSystemTrayIcon(QIcon(":/icons/tray.png"),this);
tray->setContextMenu(trayMenu);
connect(tray,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(trayActivated(QSystemTrayIcon::ActivationReason)));
tray->show();
To copy to clipboard, switch view to plain text mode
Bookmarks