Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt5 modal dialogs stuck behind main window, seems like its hanging

Qt5 modal dialogs stuck behind main window, seems like its hanging

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 3.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JPNaude
    wrote on last edited by
    #1

    Hi

    We have an issue with Qt5.1.1 deployed applications on Linux (CentOs & Ubuntu) . We find that the message boxes we show gets sent to the back of the main window when the user clicks on the main window. When you click on a blocked window it should bring the dialog to the front as on Windows. Futhermore, you can resize, minimize etc. the main window while a message box is shown.

    Can't think that we are the only ones experiencing this, it seems to be such a basic thing. We've filed "QTBUG-36669":https://bugreports.qt-project.org/browse/QTBUG-36669 but it hasn't gotten any attention since Feb.

    Its a real problem for us because users are contacting support saying the application hung on them while we are just showing a simple message box and they accidentally clicked somewhere else on the main window.

    Anybody else seen this? Any workarounds?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      KashiKyrios
      wrote on last edited by
      #2

      It would seem you have to manually call setWindowModality(Qt::WindowModal) (or Qt::ApplicationModal), otherwise the dialog is a standard, non modal one (I haven't checked, but it may be OS dependent).

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JPNaude
        wrote on last edited by
        #3

        The modality of QDialog is already set to Qt::ApplicationModal by default. We've tried both ApplicationModal and WindowModal without success.

        Note that the dialog is modal, the problem is that clicking on the main window causes the dialog to move to the back of it. This is clearly incorrect behaviour.

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          Did you try ?

          @dialog->setWindowFlags(dialog->windowFlags() | Qt::WindowStaysOnTopHint);@

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          1 Reply Last reply
          0
          • J Offline
            J Offline
            JPNaude
            wrote on last edited by
            #5

            That seems to do the trick. Strange though that its not on by default for Linux but for Windows.

            Let me go and add this to each message box...

            Thanks for the response.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved