Results 1 to 5 of 5

Thread: QDialogs are always on top - why?

  1. #1
    Join Date
    Feb 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QDialogs are always on top - why?

    Hi,
    I have an application employing a QMainWindow object. There is also an object inherited from QDialog. On pressing certain key this dialog pops up in non-modal mode. But anyway it stays always on top, covering the main window, so I have always to move it aside. I tried to set in the constructor it's windowFlags (~Qt::WindowStaysOnTopHint) but it didn't help. How to make it going behind if focus is passed to the main window?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,004 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QDialogs are always on top - why?

    If your main window is not the parent of your dialog, you should be able to put the dialog behind the window.

  3. #3
    Join Date
    Feb 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDialogs are always on top - why?

    Ok, that's it, thanks.
    But I wonder how should I make it if some dialogs have the main window as the parent? (e.g. to pass QKeyEvents up to the parent with event->ignore() )

  4. #4
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDialogs are always on top - why?

    That's strange, have you tried messing with the various window hints? Try
    Qt Code:
    1. setWindowFlags(Qt::CustomizeWindowHint | Qt::Dialog);
    To copy to clipboard, switch view to plain text mode 
    [WIKI]Building Qt on Windows CE[/WIKI]

  5. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,004 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QDialogs are always on top - why?

    But I wonder how should I make it if some dialogs have the main window as the parent? (e.g. to pass QKeyEvents up to the parent with event->ignore() )
    I haven't had such a case before, but spontaneously I think of: Storing a pointer to your main window in the dialog and then calling QCoreApplication::sendEvent() or QCoreApplication::notify().

Similar Threads

  1. Seg Fault with multiple QDialogs
    By kroenecker in forum Qt Programming
    Replies: 2
    Last Post: 21st March 2009, 15:21
  2. Replies: 1
    Last Post: 18th November 2008, 18:41

Tags for this Thread

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.