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. Sheet dialog and Menu bar-focus issue
Qt 6.11 is out! See what's new in the release blog

Sheet dialog and Menu bar-focus issue

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.6k Views 1 Watching
  • 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.
  • D Offline
    D Offline
    DivyPrakash
    wrote on last edited by
    #1

    In my application ,i display a sheet dialog (using open() and setting windows modality ),when this dialog is still in the view,user is able to click on application's menu bar and click on Quit.And when the user clicks on Quit,i have a slot to display some other sheet dialog( document dirty ).Now the issue is that the second sheet dialog is displayed behind the first sheet dialog,resulting which second sheet dialog will never be visible and user cannot do ANYTHING on the first sheet dialog.So it looks like that application is frozen.
    Is there anyway in Qt ,that i can know if already a sheet dialog is displayed?
    Or even on Quit clicked, the corresponding slot should not be invoked,since another sheet dialog is still displayed?

    Also both the dialogs have same parent and i cannot use exec to display the first sheet dialog( which btw disables the Quit menu option , i cannot use exec,since it will block the event loop which i dont want )

    Is there any way out of this situation?

    I am using Qt5 on Mac OS 10.9.5

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alex_malyu
      wrote on last edited by
      #2

      I am not sure what do you mean under sheet dialog.

      If it means that widget has Qt::Sheet ( Macintosh sheet), even so I am not an expert on Mac this should imply window modality.

      Thus to have normal modeless behavior you can't use it.
      Use normal QDialog (with flag Qt::Dialog) instead.

      Hope this help,
      Alex

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DivyPrakash
        wrote on last edited by
        #3

        Thank you very much for your reply

        The flag Qt::Dialog is the default flag for QDialog,so i think it will not make any difference.Anyways,i used it and still no difference.

        Sheet dialogs are special dialogs on Mac,to achieve that I am making sure that my dialog is a modal dialog.To achieve that i call setWindowsModiality( Qt::WindowModal ) followed by show(). (as mentioned in Qt documentation ).

        Now the issue is that ,even when this dialog is modal (according to Qt documentation) still user is able to click on Quit option on the menu bar
        (On Mac this is system-wide menu bar ).

        So according to my understanding since it is modal dialog, Quit action should not be triggered.

        To me it looks like a Qt bug.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DivyPrakash
          wrote on last edited by
          #4

          QApplication::activeModalWidget(),solved the issue for me

          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