Results 1 to 4 of 4

Thread: Bring QDialog to front

  1. #1
    Join Date
    Apr 2008
    Location
    Pavlodar, Kazakhstan
    Posts
    22
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Bring QDialog to front

    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:

    Qt Code:
    1. void EAController::iconActivated(QSystemTrayIcon::ActivationReason reason)
    2. {
    3. switch (reason) {
    4. case QSystemTrayIcon::Trigger:
    5. mainDialog->showNormal();
    6. mainDialog->activateWindow();
    7. mainDialog->raise();
    8. break;
    9. }
    10. }
    To copy to clipboard, switch view to plain text mode 

    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

  2. #2
    Join Date
    Apr 2008
    Posts
    73
    Thanks
    11
    Thanked 7 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Bring QDialog to front

    Dont know if it will make any difference, but I use:
    Qt Code:
    1. dialogue->show();
    2. dialogue->raise();
    3. dialogue->activateWindow();
    To copy to clipboard, switch view to plain text mode 

    You have got raise and activatewindow the other way round.

    Cheers,
    Phil Winder

  3. #3
    Join Date
    Apr 2008
    Location
    Pavlodar, Kazakhstan
    Posts
    22
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Bring QDialog to front

    The result is the same. But anyway thanks for the suggestion!

  4. #4
    Join Date
    Apr 2008
    Location
    Pavlodar, Kazakhstan
    Posts
    22
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Bring QDialog to front

    Hm! Compiled for Windows and everything there worked as it should. I guess the reason is inside GNOME

Similar Threads

  1. Resizing a QDialog to the content size
    By Nyphel in forum Qt Programming
    Replies: 8
    Last Post: 15th March 2007, 08:16
  2. How to bring a dialogbox to the front?
    By bood in forum Qt Programming
    Replies: 2
    Last Post: 2nd August 2006, 15:04

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.