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. What's the alternative of api 'hasPendingEvents'?
Forum Updated to NodeBB v4.3 + New Features

What's the alternative of api 'hasPendingEvents'?

Scheduled Pinned Locked Moved Unsolved General and Desktop
event handling
14 Posts 6 Posters 1.6k Views 3 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.
  • S Samuel Xue

    QCoreApplication::hasPendingEvents and QAbstractEventDispatcher::hasPendingEvents are deprecated. So is there any alternative of that api?

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #2

    @Samuel-Xue said in What's the alternative of api 'hasPendingEvents'?:

    QCoreApplication::hasPendingEvents

    Neither Qt5 not Qt6 have such a method. Same for QAbstractEventDispatcher::hasPendingEvents.

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

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      Zuuka
      wrote on last edited by Zuuka
      #3

      Yes it has @jsulm ,
      see: https://doc.qt.io/qt-5/qcoreapplication-obsolete.html#hasPendingEvents
      But it is marked obsolete.

      So any solutions on what to use instead for newer Qt?

      JonBJ 1 Reply Last reply
      0
      • Z Zuuka

        Yes it has @jsulm ,
        see: https://doc.qt.io/qt-5/qcoreapplication-obsolete.html#hasPendingEvents
        But it is marked obsolete.

        So any solutions on what to use instead for newer Qt?

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #4

        @Zuuka
        I think it was obsoleted perhaps throughout Qt5, so really only existed at Qt4?
        The simple answer is that whether there are "pending events" or not is an internal Qt detail to which you have no access and should not need to use. The natural answer is "just don't use anything like this". Why should you really need to?

        1 Reply Last reply
        0
        • Z Offline
          Z Offline
          Zuuka
          wrote on last edited by
          #5

          What if i want to be sure that no more Events are beeing processed or queued before continuing e.g. cleanup etc..?!
          Should i use processEvents(AllEvents) instead?!

          jsulmJ 1 Reply Last reply
          0
          • Z Zuuka

            What if i want to be sure that no more Events are beeing processed or queued before continuing e.g. cleanup etc..?!
            Should i use processEvents(AllEvents) instead?!

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #6

            @Zuuka As long as you're busy doing something the event queue is blocked and will not process any events.

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

            1 Reply Last reply
            0
            • Z Offline
              Z Offline
              Zuuka
              wrote on last edited by Zuuka
              #7

              can i query if it is blocked?
              In my case i just want to cleanup a Test class, and verify that all events have been processed before continuing with the cleanup.

              jsulmJ Christian EhrlicherC 2 Replies Last reply
              1
              • Z Zuuka

                can i query if it is blocked?
                In my case i just want to cleanup a Test class, and verify that all events have been processed before continuing with the cleanup.

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #8

                @Zuuka said in What's the alternative of api 'hasPendingEvents'?:

                can i query if it is blocked?

                Why? As I said: as long as your code is doing something (like a slot being executed) the event loop is blocked (means: it can't process events). There is no need to query anything.

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

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

                  Hi,

                  Out of curiosity, are you using QTest ?

                  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
                  1
                  • Z Offline
                    Z Offline
                    Zuuka
                    wrote on last edited by
                    #10

                    Yes, i am using QTest :)

                    JonBJ 1 Reply Last reply
                    0
                    • Z Zuuka

                      Yes, i am using QTest :)

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by
                      #11

                      @Zuuka Then wait patiently, and doubtless @SGaist will have some suggestion on this for you :)

                      1 Reply Last reply
                      0
                      • Z Zuuka

                        can i query if it is blocked?
                        In my case i just want to cleanup a Test class, and verify that all events have been processed before continuing with the cleanup.

                        Christian EhrlicherC Offline
                        Christian EhrlicherC Offline
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on last edited by
                        #12

                        @Zuuka said in What's the alternative of api 'hasPendingEvents'?:

                        hat all events have been processed before continuing with the cleanup.

                        What exact events?

                        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                        Visit the Qt Academy at https://academy.qt.io/catalog

                        1 Reply Last reply
                        1
                        • Z Offline
                          Z Offline
                          Zuuka
                          wrote on last edited by
                          #13

                          I think those are Custom Events.

                          1 Reply Last reply
                          0
                          • Christian EhrlicherC Offline
                            Christian EhrlicherC Offline
                            Christian Ehrlicher
                            Lifetime Qt Champion
                            wrote on last edited by
                            #14

                            Ok - why are they important? If they are that important then you also have to check for them in the first place. Use an event filter for example.

                            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                            Visit the Qt Academy at https://academy.qt.io/catalog

                            1 Reply Last reply
                            1

                            • Login

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