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. QDialog Question
Forum Updated to NodeBB v4.3 + New Features

QDialog Question

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 2 Posters 1.9k Views 2 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.
  • C Offline
    C Offline
    Crag_Hack
    wrote on last edited by Crag_Hack
    #1

    Hi I have a super quick question - in the QDialog documentation it says:

    If you use show() and setModal(true) together to perform a long operation, you must call QApplication::processEvents() periodically during processing to enable the user to interact with the dialog. (See QProgressDialog.)
    

    If I'm not performing a long blocking operation I don't need to call processEvents() right? The dialog will return control to the event loop to update the GUI and prevent GUI blocking since there's no blocking operation occurring right? The dialog is just to present information to and get input from the user.
    Thanks

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      It depends on how you use the dialog (open vs exec). Open will show the dialog and continue execution while exec will block the execution of your application and spin a secondary event loop that will process events in the context of the dialog.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Crag_Hack
        wrote on last edited by
        #3

        So if I use open or show and there's no blocking operation started after I present the dialog there will be no GUI blocking, nothing to worry about right? And open() is the same as setmodal(true) and show() right?

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Crag_Hack
          wrote on last edited by
          #4

          Better question - what's the difference between a normal event loop and the one spawned by exec'ing a dialog? Is it just where they originate from? A secondary event loop as mentioned previously will process events in the overall application's event loop right?

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Crag_Hack
            wrote on last edited by
            #5

            Did a quick experiment - timers are being run with both modal dialog run from show() and qmessagebox exec()'d. Question answered.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              They will indeed, but they won't be handled in the same event loop.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • C Offline
                C Offline
                Crag_Hack
                wrote on last edited by
                #7

                Does this have any functional impact on the behavior of the program?

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Well, it highly depends on what your program does and what should or shouldn't happen while the dialog is shown.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  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