Results 1 to 4 of 4

Thread: Qt5 and modal windows

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2009
    Posts
    52
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Qt5 and modal windows

    I have a QFrame displayed as a subwindow (so it doesn't have a taskbar button) and also modal, with no parent.

    In Qt4, when pressing on the application taskbar button the frame is always on top of the application. Also this happens when choosing another application then coming back to my application.

    In Qt5 however, when I press on my application button, the main window comes on top, hiding the modal frame, making the application unusable, since the modal frame is behind, so I can only close it from the task manager.

    This is what I'm using:

    Qt Code:
    1. setWindowFlags(Qt::FramelessWindowHint | Qt::SubWindow);
    2.  
    3. setWindowModality(Qt::ApplicationModal);
    To copy to clipboard, switch view to plain text mode 

    I'm absolutely sure it's a Qt5 problem, because I use the exact same code with both versions

    Any idea how can I make this thing behave sanely in Qt5?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,321
    Thanks
    316
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt5 and modal windows

    Maybe you also need Qt::WindowStaysOnTopHint. Or simply give your dialog a parent - being parentless is the root cause of your problem; if it were a child of your main widget, it would always be on top.

  3. The following user says thank you to d_stranz for this useful post:

    Carlsberg (5th May 2013)

Similar Threads

  1. Qt non modal form how to
    By ras in forum Qt Programming
    Replies: 0
    Last Post: 5th August 2010, 19:20
  2. QWidget "allways on top + modal to all windows"
    By boblatino in forum Qt Programming
    Replies: 2
    Last Post: 24th July 2010, 19:30
  3. Modal dialog should not get hide behind windows task bar
    By sanjayshelke in forum Qt Programming
    Replies: 0
    Last Post: 11th September 2009, 16:08
  4. Qt Modal/Modeless possible bug in MS Windows
    By Daliphant in forum Qt Programming
    Replies: 1
    Last Post: 11th June 2008, 17:41
  5. Bug with modal windows on Mac? [Qt 3.3]
    By kalos80 in forum Qt Programming
    Replies: 0
    Last Post: 15th February 2008, 16:52

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
  •  
Qt is a trademark of The Qt Company.