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. Closing modal window programatically = STUCK (MacOSX + Qt5.4)
Qt 6.11 is out! See what's new in the release blog

Closing modal window programatically = STUCK (MacOSX + Qt5.4)

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.1k 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.
  • N Offline
    N Offline
    netherby
    wrote on last edited by
    #1

    So I have some custom dialogs. They start life as a QWidget and have setWindowModality called on them.

    The application does not run in the Qt event loop, instead calling processEvents & postEvents inside its own loop.

    If you close the modal windows using the (x) close button in the title bar then everything works as expected except that you still cannot quit the application. But when closed by pressing the 'done' button (which implements a bunch of checks and stuff), the application becomes 'stuck' as though the model window is still open.

    What actually needs to happen for the app to stop the modality? I'v tried calling close() on the window and not deleting the object, setting it non modal before closing it and some other ideas. But nothing works.

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rondog
      wrote on last edited by
      #2

      There may be a difference between using the 'X' vs a button signal (depends on which QDialog slot you use).

      I usually implement QDialog::closeEvent(QEvent *event) so I can handle anything needed when closing the dialog from various options.

      What slot do you attach to your 'done' button?

      1 Reply Last reply
      0
      • N Offline
        N Offline
        netherby
        wrote on last edited by
        #3

        I'm not using any of the QDialog slots, the 'done' buttons' clicked slot is connected to a function which causes the event loop to process the data and close the dialog.

        The reason the 'X' button isn't connected to anything is because I wasn't planning to show it. Just enabled it for debugging.

        However even pressing the 'X' button still causes the app to get semi-stuck, since it beeps if you try to quit. Everything works correctly if the Dialog is not set modal.

        I'm just really confused about what I'm doing wrong..

        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