PDA

View Full Version : Bring QDialog to front



mitro
21st April 2008, 16:03
I have a QDialog and a QSystemTrayIcon. When the user clicks close or minimize buttons the dialog hides to the system tray icon. If then the user activates the icon the dialog is shown on the top of the desktop. It works fine. Here is the code:


void EAController::iconActivated(QSystemTrayIcon::Activ ationReason reason)
{
switch (reason) {
case QSystemTrayIcon::Trigger:
mainDialog->showNormal();
mainDialog->activateWindow();
mainDialog->raise();
break;
}
}

The problem comes when the dialog is on the desktop but behind some other window. I click the tray icon, the dialog activates but still remains behind other window (now deactivated). How can I force the dialog to appear on the top? I use Ubuntu 7.10 with GNOME 2.20.1

philwinder
21st April 2008, 16:40
Dont know if it will make any difference, but I use:

dialogue->show();
dialogue->raise();
dialogue->activateWindow();

You have got raise and activatewindow the other way round.

Cheers,
Phil Winder

mitro
21st April 2008, 16:48
The result is the same. :( But anyway thanks for the suggestion! ;)

mitro
21st April 2008, 21:32
Hm! Compiled for Windows and everything there worked as it should. I guess the reason is inside GNOME :(