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. QMessageBox::warning replacement that wont process the event loop

QMessageBox::warning replacement that wont process the event loop

Scheduled Pinned Locked Moved Unsolved General and Desktop
40 Posts 9 Posters 4.5k 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.
  • S Offline
    S Offline
    stefanwoe
    wrote on 25 May 2022, 11:18 last edited by
    #1

    Again and again i come into a situation where
    QMessageBox::warning
    or the like process events in the background which leads to errors and crashes of my application. I.e when loading a document i use QMessageBox::warning to show problems of the loaded file and ask a user how to handle them. But the call to QMessageBox::warning in turn will send events to the document window which is in a non valid state yet etc.

    Id like to replace QMessageBox::warning with a own implementation that will not process events.
    How can this be easily done? Will a simple Dialog that i call with myDailog.exec() keep the event loop untouched? Or is there possibly a attribute that i can set?

    J M J 3 Replies Last reply 25 May 2022, 11:32
    0
    • S stefanwoe
      25 May 2022, 11:18

      Again and again i come into a situation where
      QMessageBox::warning
      or the like process events in the background which leads to errors and crashes of my application. I.e when loading a document i use QMessageBox::warning to show problems of the loaded file and ask a user how to handle them. But the call to QMessageBox::warning in turn will send events to the document window which is in a non valid state yet etc.

      Id like to replace QMessageBox::warning with a own implementation that will not process events.
      How can this be easily done? Will a simple Dialog that i call with myDailog.exec() keep the event loop untouched? Or is there possibly a attribute that i can set?

      J Offline
      J Offline
      JonB
      wrote on 25 May 2022, 11:32 last edited by JonB
      #2

      @stefanwoe
      I am surprised at your issue. For example, I would have thought if a "document (window) is not in a valid state" you could set a flag for that if you need to. However there may not be much point debating.

      Since QMessageBox derives from QDialog I would have thought it "unlikely" the latter will behave differently in respect of you wishing events not to be processed.

      Have you tried whether QMessageBox with a nullptr parent helps your situation?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        stefanwoe
        wrote on 25 May 2022, 12:05 last edited by stefanwoe
        #3

        I agree that in a perfect world this shouldn't happen. And i rather see this problem on user reports than on debugging. The situations are typically more complex as described in my example. In most cases its not a problem. In some - very rare but unexpected ones - it is.

        Unfortunately a nullptr parent does not help. See the stack below, which starts with ```
        QMessageBox::warning(0x0000000000000000 and this still sends a activate event when switching to the application etc.:

        Qt6Cored.dll!doActivate<0>(0x0000021a8dad3f90, 7, 0x000000af0bf92a58) Line 3919	C++
        Qt6Cored.dll!QMetaObject::activate(0x0000021a8dad3f90, 0x00007ffa8df943d0, 0, 0x000000af0bf92a58) Line 3965	C++
        Qt6Widgetsd.dll!QMdiArea::subWindowActivated(0x0000021a928c29b0) Line 309	C++
        Qt6Widgetsd.dll!QMdiAreaPrivate::emitWindowActivated(0x0000021a928c29b0) Line 1083	C++
        Qt6Widgetsd.dll!QMdiAreaPrivate::_q_processWindowStateChanged({...}, {...}) Line 758	C++
        Qt6Widgetsd.dll!QMdiArea::qt_static_metacall(0x0000021a8dad3f90, InvokeMetaMethod, 10, 0x000000af0bf92fc8) Line 181	C++
        Qt6Cored.dll!doActivate<0>(0x0000021a928c29b0, 7, 0x000000af0bf92fc8) Line 3919	C++
        Qt6Cored.dll!QMetaObject::activate(0x0000021a928c29b0, 0x00007ffa8df9f5f0, 0, 0x000000af0bf92fc8) Line 3965	C++
        Qt6Widgetsd.dll!QMdiSubWindow::windowStateChanged({...}, {...}) Line 229	C++
        Qt6Widgetsd.dll!QMdiSubWindowPrivate::setActive(true, false) Line 1470	C++
        Qt6Widgetsd.dll!QMdiAreaPrivate::activateCurrentWindow() Line 1016	C++
        Qt6Widgetsd.dll!QMdiArea::eventFilter(0x000000af0bf9f7b8, 0x000000af0bf94388) Line 2594	C++
        Qt6Cored.dll!QCoreApplicationPrivate::sendThroughApplicationEventFilters(0x000000af0bf9f7b8, 0x000000af0bf94388) Line 1171	C++
        Qt6Widgetsd.dll!QApplicationPrivate::notify_helper(0x000000af0bf9f7b8, 0x000000af0bf94388) Line 3372	C++
        Qt6Widgetsd.dll!QApplication::notify(0x000000af0bf9f7b8, 0x000000af0bf94388) Line 2760	C++
        Qt6Cored.dll!QCoreApplication::notifyInternal2(0x000000af0bf9f7b8, 0x000000af0bf94388) Line 1063	C++
        Qt6Cored.dll!QCoreApplication::sendSpontaneousEvent(0x000000af0bf9f7b8, 0x000000af0bf94388) Line 1484	C++
        Qt6Guid.dll!QGuiApplicationPrivate::setApplicationState(ApplicationActive, false) Line 3688	C++
        Qt6Guid.dll!QGuiApplicationPrivate::processActivatedEvent(0x0000021a93d338b0) Line 2482	C++
        Qt6Guid.dll!QGuiApplicationPrivate::processWindowSystemEvent(0x0000021a93d338b0) Line 2033	C++
        Qt6Guid.dll!QWindowSystemInterface::sendWindowSystemEvents({...}) Line 1172	C++
        Qt6Guid.dll!QWindowsGuiEventDispatcher::sendPostedEvents() Line 81	C++
        Qt6Cored.dll!QEventDispatcherWin32::processEvents({...}) Line 474	C++
        Qt6Guid.dll!QWindowsGuiEventDispatcher::processEvents({...}) Line 72	C++
        Qt6Cored.dll!QEventLoop::processEvents({...}) Line 140	C++
        Qt6Cored.dll!QEventLoop::exec({...}) Line 232	C++
        Qt6Widgetsd.dll!QDialog::exec() Line 600	C++
        Qt6Widgetsd.dll!showNewMessageBox(0x0000000000000000, Warning, {...}, {...}, {...}, NoButton) Line 1646	C++
        Qt6Widgetsd.dll!QMessageBox::warning(0x0000000000000000, {...}, {...}, {...}, NoButton) Line 1747	C++
        
        
        1 Reply Last reply
        0
        • S stefanwoe
          25 May 2022, 11:18

          Again and again i come into a situation where
          QMessageBox::warning
          or the like process events in the background which leads to errors and crashes of my application. I.e when loading a document i use QMessageBox::warning to show problems of the loaded file and ask a user how to handle them. But the call to QMessageBox::warning in turn will send events to the document window which is in a non valid state yet etc.

          Id like to replace QMessageBox::warning with a own implementation that will not process events.
          How can this be easily done? Will a simple Dialog that i call with myDailog.exec() keep the event loop untouched? Or is there possibly a attribute that i can set?

          M Offline
          M Offline
          mpergand
          wrote on 25 May 2022, 12:07 last edited by mpergand
          #4

          @stefanwoe said in QMessageBox::warning replacement that wont process the event loop:

          Id like to replace QMessageBox::warning with a own implementation that will not process events.

          Hi,
          You can create your own eventloop like that:

          /** BUG Qt 5.12
              *  Le sheet saute au milieu de l'écran
              */  
             
             fileDialog.open();
             
             QEventLoop eventLoop;
             connect(&fileDialog, &QFileDialog::finished, &eventLoop,&QEventLoop::quit);
             eventLoop.exec();
             
             if(fileDialog.result() == QDialog::Accepted)
                 {
                 QStringList list=fileDialog.selectedFiles();
                 
                 if(!list.isEmpty())
             		filename=list.at(0);
                 }
             
             return filename;
          

          This silly code is the result of a silly bug in Qt5.12

          But, It should be unecessary because QDialog::exec or QMessage::exec already do that and block the main event loop.

          S 1 Reply Last reply 25 May 2022, 12:35
          0
          • S stefanwoe
            25 May 2022, 11:18

            Again and again i come into a situation where
            QMessageBox::warning
            or the like process events in the background which leads to errors and crashes of my application. I.e when loading a document i use QMessageBox::warning to show problems of the loaded file and ask a user how to handle them. But the call to QMessageBox::warning in turn will send events to the document window which is in a non valid state yet etc.

            Id like to replace QMessageBox::warning with a own implementation that will not process events.
            How can this be easily done? Will a simple Dialog that i call with myDailog.exec() keep the event loop untouched? Or is there possibly a attribute that i can set?

            J Online
            J Online
            J.Hilk
            Moderators
            wrote on 25 May 2022, 12:28 last edited by
            #5

            @stefanwoe the solution is to use complete QMessageBox instance and show it by calling show() and not exec().

            exec() will spann the event loop, show will rely on your main event loop

            the static call off QMessageBox::warning will also spawn an additional event loop.

            but, this will result in your having to refactor stuff, as the show() call does not "wait" inplace on the user input!


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            S 1 Reply Last reply 25 May 2022, 12:51
            1
            • M mpergand
              25 May 2022, 12:07

              @stefanwoe said in QMessageBox::warning replacement that wont process the event loop:

              Id like to replace QMessageBox::warning with a own implementation that will not process events.

              Hi,
              You can create your own eventloop like that:

              /** BUG Qt 5.12
                  *  Le sheet saute au milieu de l'écran
                  */  
                 
                 fileDialog.open();
                 
                 QEventLoop eventLoop;
                 connect(&fileDialog, &QFileDialog::finished, &eventLoop,&QEventLoop::quit);
                 eventLoop.exec();
                 
                 if(fileDialog.result() == QDialog::Accepted)
                     {
                     QStringList list=fileDialog.selectedFiles();
                     
                     if(!list.isEmpty())
                 		filename=list.at(0);
                     }
                 
                 return filename;
              

              This silly code is the result of a silly bug in Qt5.12

              But, It should be unecessary because QDialog::exec or QMessage::exec already do that and block the main event loop.

              S Offline
              S Offline
              stefanwoe
              wrote on 25 May 2022, 12:35 last edited by
              #6

              @mpergand said in QMessageBox::warning replacement that wont process the event loop:

              But, It should be unecessary because QDialog::exec or QMessage::exec already do that and block the main event loop.

              Well they process events at least - see the stack above.

              Inspired by your code i tried:

              QMessageBox msgBox(this);
              msgBox.setText("My message");
              msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
              msgBox.setDefaultButton(QMessageBox::Yes);
              QEventLoop eventLoop;
              connect(&msgBox, &QMessageBox::finished, &eventLoop,&QEventLoop::quit);
              int ret = eventLoop.exec();  
              

              The Dialog wont show, but eventLoop.exec(); blocks. probably i missed something?

              J 1 Reply Last reply 25 May 2022, 12:37
              0
              • S stefanwoe
                25 May 2022, 12:35

                @mpergand said in QMessageBox::warning replacement that wont process the event loop:

                But, It should be unecessary because QDialog::exec or QMessage::exec already do that and block the main event loop.

                Well they process events at least - see the stack above.

                Inspired by your code i tried:

                QMessageBox msgBox(this);
                msgBox.setText("My message");
                msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
                msgBox.setDefaultButton(QMessageBox::Yes);
                QEventLoop eventLoop;
                connect(&msgBox, &QMessageBox::finished, &eventLoop,&QEventLoop::quit);
                int ret = eventLoop.exec();  
                

                The Dialog wont show, but eventLoop.exec(); blocks. probably i missed something?

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 25 May 2022, 12:37 last edited by
                #7

                @stefanwoe said in QMessageBox::warning replacement that wont process the event loop:

                probably i missed something?

                Yes, you do not show your dialog

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                S 1 Reply Last reply 25 May 2022, 12:49
                0
                • J jsulm
                  25 May 2022, 12:37

                  @stefanwoe said in QMessageBox::warning replacement that wont process the event loop:

                  probably i missed something?

                  Yes, you do not show your dialog

                  S Offline
                  S Offline
                  stefanwoe
                  wrote on 25 May 2022, 12:49 last edited by
                  #8

                  @jsulm Youre right. I added msgBox.show();

                  QMessageBox msgBox(this);
                  msgBox.setText("My message");
                  msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
                  msgBox.setDefaultButton(QMessageBox::Yes);
                  
                  QEventLoop eventLoop;
                  connect(&msgBox, &QMessageBox::finished, &eventLoop,&QEventLoop::quit);
                  msgBox.show();
                  int ret =    eventLoop.exec();
                  

                  This works, but still it processes events - as far as i understand it this connect(...) just adds a additional event loop, but does not replace the default one:

                  Qt6Cored.dll!doActivate<0>(0x00000268d32e5e70, 7, 0x0000006f304f29f8) Line 3919	C++
                  Qt6Cored.dll!QMetaObject::activate(0x00000268d32e5e70, 0x00007ffa80a243d0, 0, 0x0000006f304f29f8) Line 3965	C++
                  Qt6Widgetsd.dll!QMdiArea::subWindowActivated(0x00000268d378ae20) Line 309	C++
                  Qt6Widgetsd.dll!QMdiAreaPrivate::emitWindowActivated(0x00000268d378ae20) Line 1083	C++
                  Qt6Widgetsd.dll!QMdiAreaPrivate::_q_processWindowStateChanged({...}, {...}) Line 758	C++
                  Qt6Widgetsd.dll!QMdiArea::qt_static_metacall(0x00000268d32e5e70, InvokeMetaMethod, 10, 0x0000006f304f2f68) Line 181	C++
                  Qt6Cored.dll!doActivate<0>(0x00000268d378ae20, 7, 0x0000006f304f2f68) Line 3919	C++
                  Qt6Cored.dll!QMetaObject::activate(0x00000268d378ae20, 0x00007ffa80a2f5f0, 0, 0x0000006f304f2f68) Line 3965	C++
                  Qt6Widgetsd.dll!QMdiSubWindow::windowStateChanged({...}, {...}) Line 229	C++
                  Qt6Widgetsd.dll!QMdiSubWindowPrivate::setActive(true, false) Line 1470	C++
                  Qt6Widgetsd.dll!QMdiAreaPrivate::activateCurrentWindow() Line 1016	C++
                  Qt6Widgetsd.dll!QMdiArea::eventFilter(0x0000006f304ff4e8, 0x0000006f304f4328) Line 2594	C++
                  Qt6Cored.dll!QCoreApplicationPrivate::sendThroughApplicationEventFilters(0x0000006f304ff4e8, 0x0000006f304f4328) Line 1171	C++
                  Qt6Widgetsd.dll!QApplicationPrivate::notify_helper(0x0000006f304ff4e8, 0x0000006f304f4328) Line 3372	C++
                  Qt6Widgetsd.dll!QApplication::notify(0x0000006f304ff4e8, 0x0000006f304f4328) Line 2760	C++
                  Qt6Cored.dll!QCoreApplication::notifyInternal2(0x0000006f304ff4e8, 0x0000006f304f4328) Line 1063	C++
                  Qt6Cored.dll!QCoreApplication::sendSpontaneousEvent(0x0000006f304ff4e8, 0x0000006f304f4328) Line 1484	C++
                  Qt6Guid.dll!QGuiApplicationPrivate::setApplicationState(ApplicationActive, false) Line 3688	C++
                  Qt6Guid.dll!QGuiApplicationPrivate::processActivatedEvent(0x00000268d9547bb0) Line 2482	C++
                  Qt6Guid.dll!QGuiApplicationPrivate::processWindowSystemEvent(0x00000268d9547bb0) Line 2033	C++
                  Qt6Guid.dll!QWindowSystemInterface::sendWindowSystemEvents({...}) Line 1172	C++
                  Qt6Guid.dll!QWindowsGuiEventDispatcher::sendPostedEvents() Line 81	C++
                  Qt6Cored.dll!QEventDispatcherWin32::processEvents({...}) Line 474	C++
                  Qt6Guid.dll!QWindowsGuiEventDispatcher::processEvents({...}) Line 72	C++
                  Qt6Cored.dll!QEventLoop::processEvents({...}) Line 140	C++
                  Qt6Cored.dll!QEventLoop::exec({...}) Line 232	C++
                  
                  1 Reply Last reply
                  0
                  • J J.Hilk
                    25 May 2022, 12:28

                    @stefanwoe the solution is to use complete QMessageBox instance and show it by calling show() and not exec().

                    exec() will spann the event loop, show will rely on your main event loop

                    the static call off QMessageBox::warning will also spawn an additional event loop.

                    but, this will result in your having to refactor stuff, as the show() call does not "wait" inplace on the user input!

                    S Offline
                    S Offline
                    stefanwoe
                    wrote on 25 May 2022, 12:51 last edited by
                    #9

                    @J-Hilk This seems like a good starting point, but i dont get this to work ad hoc. How can this be used as a modal dialog? Any references?

                    J 1 Reply Last reply 25 May 2022, 12:54
                    0
                    • S stefanwoe
                      25 May 2022, 12:51

                      @J-Hilk This seems like a good starting point, but i dont get this to work ad hoc. How can this be used as a modal dialog? Any references?

                      J Online
                      J Online
                      J.Hilk
                      Moderators
                      wrote on 25 May 2022, 12:54 last edited by
                      #10

                      @stefanwoe said in QMessageBox::warning replacement that wont process the event loop:

                      w can this be used as a modal dialog? Any references?

                      :D

                      setWindowModality(Qt::ApplicationModal);

                      https://doc.qt.io/qt-5/qmessagebox.html#setWindowModality


                      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                      Q: What's that?
                      A: It's blue light.
                      Q: What does it do?
                      A: It turns blue.

                      S 1 Reply Last reply 25 May 2022, 13:02
                      1
                      • J J.Hilk
                        25 May 2022, 12:54

                        @stefanwoe said in QMessageBox::warning replacement that wont process the event loop:

                        w can this be used as a modal dialog? Any references?

                        :D

                        setWindowModality(Qt::ApplicationModal);

                        https://doc.qt.io/qt-5/qmessagebox.html#setWindowModality

                        S Offline
                        S Offline
                        stefanwoe
                        wrote on 25 May 2022, 13:02 last edited by
                        #11

                        @J-Hilk
                        i tried this here (of course a incomplete test):

                        QMessageBox msgBox(this);
                        msgBox.setText("My message");
                        msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
                        msgBox.setDefaultButton(QMessageBox::Yes);
                        msgBox.setWindowModality(Qt::ApplicationModal);
                        msgBox.show();
                        

                        show() now of course will not wait until the dialog is closed etc. How can i accomplish this? It seems like the correct way, but so far i dont get it.

                        J 1 Reply Last reply 25 May 2022, 13:03
                        0
                        • S stefanwoe
                          25 May 2022, 13:02

                          @J-Hilk
                          i tried this here (of course a incomplete test):

                          QMessageBox msgBox(this);
                          msgBox.setText("My message");
                          msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
                          msgBox.setDefaultButton(QMessageBox::Yes);
                          msgBox.setWindowModality(Qt::ApplicationModal);
                          msgBox.show();
                          

                          show() now of course will not wait until the dialog is closed etc. How can i accomplish this? It seems like the correct way, but so far i dont get it.

                          J Online
                          J Online
                          J.Hilk
                          Moderators
                          wrote on 25 May 2022, 13:03 last edited by
                          #12

                          @stefanwoe
                          make msgBox persistent, for example as a class member, then it should at least show.


                          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                          Q: What's that?
                          A: It's blue light.
                          Q: What does it do?
                          A: It turns blue.

                          S 1 Reply Last reply 25 May 2022, 13:06
                          0
                          • J J.Hilk
                            25 May 2022, 13:03

                            @stefanwoe
                            make msgBox persistent, for example as a class member, then it should at least show.

                            S Offline
                            S Offline
                            stefanwoe
                            wrote on 25 May 2022, 13:06 last edited by
                            #13

                            @J-Hilk It shows - but i how can do i add a loop or the like to process the dialog until a button is pressed?

                            J 1 Reply Last reply 25 May 2022, 13:09
                            0
                            • S stefanwoe
                              25 May 2022, 13:06

                              @J-Hilk It shows - but i how can do i add a loop or the like to process the dialog until a button is pressed?

                              J Online
                              J Online
                              J.Hilk
                              Moderators
                              wrote on 25 May 2022, 13:09 last edited by J.Hilk
                              #14

                              @stefanwoe you can't that's why I wrote:

                              but, this will result in your having to refactor stuff, as the show() call does not "wait" inplace on the user input!

                              your code/ function block will have to end on the show() call of your message box, and than you "continue" in a slot/function connected to one of its signals, for example
                              https://doc.qt.io/qt-5/qdialog.html#finished


                              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                              Q: What's that?
                              A: It's blue light.
                              Q: What does it do?
                              A: It turns blue.

                              S 1 Reply Last reply 25 May 2022, 13:13
                              0
                              • J J.Hilk
                                25 May 2022, 13:09

                                @stefanwoe you can't that's why I wrote:

                                but, this will result in your having to refactor stuff, as the show() call does not "wait" inplace on the user input!

                                your code/ function block will have to end on the show() call of your message box, and than you "continue" in a slot/function connected to one of its signals, for example
                                https://doc.qt.io/qt-5/qdialog.html#finished

                                S Offline
                                S Offline
                                stefanwoe
                                wrote on 25 May 2022, 13:13 last edited by
                                #15

                                @J-Hilk That i understand - but this will continue code execution after the msgBox.show() statement - as it wont block control flow. So the code after msgBox.show() will be executed while the dialog is shown. But what i want, is a replacement for QMessageBox::warning which blocks further execution while the dialog is shown.
                                How can that be done?

                                J J 2 Replies Last reply 25 May 2022, 13:21
                                0
                                • S stefanwoe
                                  25 May 2022, 13:13

                                  @J-Hilk That i understand - but this will continue code execution after the msgBox.show() statement - as it wont block control flow. So the code after msgBox.show() will be executed while the dialog is shown. But what i want, is a replacement for QMessageBox::warning which blocks further execution while the dialog is shown.
                                  How can that be done?

                                  J Online
                                  J Online
                                  J.Hilk
                                  Moderators
                                  wrote on 25 May 2022, 13:21 last edited by
                                  #16

                                  @stefanwoe said in QMessageBox::warning replacement that wont process the event loop:

                                  How can that be done?

                                  it can't not without calls to processEvents() or additional QEventLoops


                                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                                  Q: What's that?
                                  A: It's blue light.
                                  Q: What does it do?
                                  A: It turns blue.

                                  1 Reply Last reply
                                  1
                                  • M Offline
                                    M Offline
                                    mchinand
                                    wrote on 25 May 2022, 13:30 last edited by
                                    #17
                                    This post is deleted!
                                    1 Reply Last reply
                                    0
                                    • S stefanwoe
                                      25 May 2022, 13:13

                                      @J-Hilk That i understand - but this will continue code execution after the msgBox.show() statement - as it wont block control flow. So the code after msgBox.show() will be executed while the dialog is shown. But what i want, is a replacement for QMessageBox::warning which blocks further execution while the dialog is shown.
                                      How can that be done?

                                      J Offline
                                      J Offline
                                      JonB
                                      wrote on 25 May 2022, 13:47 last edited by
                                      #18

                                      @stefanwoe
                                      As @J-Hilk says.
                                      And since your earlier traceback showed

                                      ...
                                      Qt6Cored.dll!QEventDispatcherWin32::processEvents({...}) Line 474	C++
                                      Qt6Guid.dll!QWindowsGuiEventDispatcher::processEvents({...}) Line 72	C++
                                      Qt6Cored.dll!QEventLoop::processEvents({...}) Line 140	C++
                                      Qt6Cored.dll!QEventLoop::exec({...}) Line 232	C++
                                      

                                      it seems to me likely/possible that you will be in the same state as you were originally.....

                                      1 Reply Last reply
                                      0
                                      • S Offline
                                        S Offline
                                        stefanwoe
                                        wrote on 25 May 2022, 14:39 last edited by
                                        #19

                                        I now tried:

                                        QMessageBox msgBox(this);
                                        msgBox.setText("My message");
                                        msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
                                        msgBox.setDefaultButton(QMessageBox::Yes);
                                        msgBox.setWindowModality(Qt::ApplicationModal);
                                        msgBox.show();
                                        QEventLoop eventLoop(&msgBox);
                                        eventLoop.exec(QEventLoop::DialogExec);
                                        

                                        Still the same problem.

                                        Inspecting the call stack in the debugger i think the root problem lies in

                                        Qt6Guid.dll!QGuiApplicationPrivate::processWindowSystemEvent(0x000001577107c8c0) 
                                        Qt6Guid.dll!QWindowSystemInterface::sendWindowSystemEvents({...}) Line 1172	C++
                                        Qt6Guid.dll!QWindowsGuiEventDispatcher::sendPostedEvents() Line 81	C++
                                        Qt6Cored.dll!QEventDispatcherWin32::processEvents({...}) Line 474	C++
                                        Qt6Guid.dll!QWindowsGuiEventDispatcher::processEvents({...}) Line 72	C++
                                        Qt6Cored.dll!QEventLoop::processEvents({...}) Line 140	C++
                                        Qt6Cored.dll!QEventLoop::exec({...}) Line 232	C++
                                        

                                        I can not find any configurable way to - temporarily - skip this call chain, when using QEventLoop.

                                        J 1 Reply Last reply 25 May 2022, 15:06
                                        0
                                        • S stefanwoe
                                          25 May 2022, 14:39

                                          I now tried:

                                          QMessageBox msgBox(this);
                                          msgBox.setText("My message");
                                          msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
                                          msgBox.setDefaultButton(QMessageBox::Yes);
                                          msgBox.setWindowModality(Qt::ApplicationModal);
                                          msgBox.show();
                                          QEventLoop eventLoop(&msgBox);
                                          eventLoop.exec(QEventLoop::DialogExec);
                                          

                                          Still the same problem.

                                          Inspecting the call stack in the debugger i think the root problem lies in

                                          Qt6Guid.dll!QGuiApplicationPrivate::processWindowSystemEvent(0x000001577107c8c0) 
                                          Qt6Guid.dll!QWindowSystemInterface::sendWindowSystemEvents({...}) Line 1172	C++
                                          Qt6Guid.dll!QWindowsGuiEventDispatcher::sendPostedEvents() Line 81	C++
                                          Qt6Cored.dll!QEventDispatcherWin32::processEvents({...}) Line 474	C++
                                          Qt6Guid.dll!QWindowsGuiEventDispatcher::processEvents({...}) Line 72	C++
                                          Qt6Cored.dll!QEventLoop::processEvents({...}) Line 140	C++
                                          Qt6Cored.dll!QEventLoop::exec({...}) Line 232	C++
                                          

                                          I can not find any configurable way to - temporarily - skip this call chain, when using QEventLoop.

                                          J Offline
                                          J Offline
                                          JonB
                                          wrote on 25 May 2022, 15:06 last edited by
                                          #20

                                          @stefanwoe
                                          I don't think you can, that is my point. You need an event loop to deal with any dialog, and some event being processed is upsetting something in the system....
                                          Really ISTM the original issue, whatever it is/causes it, ought be sorted out. Like a (reproducible) bug report. But that may take time for a resolution.....

                                          1 Reply Last reply
                                          0

                                          10/40

                                          25 May 2022, 12:54

                                          topic:navigator.unread, 30
                                          • Login

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