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. processEvent() differs between Qt4 and Qt5
Forum Updated to NodeBB v4.3 + New Features

processEvent() differs between Qt4 and Qt5

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 477 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.
  • J Offline
    J Offline
    JulienMaille
    wrote on last edited by
    #1

    I'm using QxtSignalWaiter to wait synchronously for a signal, with no issues and, as stated in another topic here, it worked fine until Qt5.9/5.10. Then it started to get stuck in the processEvent() call and generate other erratic behaviors.
    https://bitbucket.org/libqxt/libqxt/src/696423b68972fc9edae318558b8ce26dc187cc40/src/core/qxtsignalwaiter.cpp#lines-144:145

    Looking at Qt5 documentation I see 2 additions that are not in the Qt4 manual.

    void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents)
    [...]
    Calling this function processes events only for the calling thread, and returns after all available events have been processed. Available events are events queued before the function call. This means that events that are posted while the function runs will be queued until a later round of event processing.

    void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags, int ms)
    This function overloads processEvents().
    [...]
    Note: Unlike the processEvents() overload, this function also processes events that are posted while the function runs.
    Note: All events that were queued before the timeout will be processed, however long it takes.

    This could explain the problem I have, however I never found a warning when reading the Qt4 to Qt5 porting guide. Maybe the change is only in the manual? If not, are there complete list of potential problems to expect when porting to Qt5?

    jsulmJ 1 Reply Last reply
    0
    • J JulienMaille

      I'm using QxtSignalWaiter to wait synchronously for a signal, with no issues and, as stated in another topic here, it worked fine until Qt5.9/5.10. Then it started to get stuck in the processEvent() call and generate other erratic behaviors.
      https://bitbucket.org/libqxt/libqxt/src/696423b68972fc9edae318558b8ce26dc187cc40/src/core/qxtsignalwaiter.cpp#lines-144:145

      Looking at Qt5 documentation I see 2 additions that are not in the Qt4 manual.

      void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents)
      [...]
      Calling this function processes events only for the calling thread, and returns after all available events have been processed. Available events are events queued before the function call. This means that events that are posted while the function runs will be queued until a later round of event processing.

      void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags, int ms)
      This function overloads processEvents().
      [...]
      Note: Unlike the processEvents() overload, this function also processes events that are posted while the function runs.
      Note: All events that were queued before the timeout will be processed, however long it takes.

      This could explain the problem I have, however I never found a warning when reading the Qt4 to Qt5 porting guide. Maybe the change is only in the manual? If not, are there complete list of potential problems to expect when porting to Qt5?

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

      @JulienMaille If you want to wait synchronously you should rather use a local event loop: https://doc.qt.io/qt-5/qeventloop.html

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

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

        @JulienMaille said in processEvent() differs between Qt4 and Qt5:

        If not, are there complete list of potential problems to expect when porting to Qt5?

        QxtSignalWaiter is not a Qt class but Qxt - you should ask there.

        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
        • J Offline
          J Offline
          JulienMaille
          wrote on last edited by
          #4

          My question targets processEvent() not Qxt (which stopped being maintained year ago)

          Pl45m4P Christian EhrlicherC 2 Replies Last reply
          0
          • J JulienMaille

            My question targets processEvent() not Qxt (which stopped being maintained year ago)

            Pl45m4P Offline
            Pl45m4P Offline
            Pl45m4
            wrote on last edited by Pl45m4
            #5

            @JulienMaille said in processEvent() differs between Qt4 and Qt5:

            My question targets processEvent()

            You are comparing two different overloads...

            They are both in both Qt releases, as you can see here:

            Qt4:

            • 1: https://doc.qt.io/archives/qt-4.8/qcoreapplication.html#processEvents
            • 2: https://doc.qt.io/archives/qt-4.8/qcoreapplication.html#processEvents-2

            Qt5:

            • 1: https://doc.qt.io/qt-5/qcoreapplication.html#processEvents
            • 2: https://doc.qt.io/qt-5/qcoreapplication.html#processEvents-1

            I guess they just added some more information to the (Qt5) documentation.


            If debugging is the process of removing software bugs, then programming must be the process of putting them in.

            ~E. W. Dijkstra

            1 Reply Last reply
            0
            • J JulienMaille

              My question targets processEvent() not Qxt (which stopped being maintained year ago)

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

              @JulienMaille said in processEvent() differs between Qt4 and Qt5:

              My question targets processEvent() not Qxt

              I'm using QxtSignalWaiter to wait synchronously for a signal, with no issues and, as stated in another topic here, it worked fine until Qt5.9/5.10. Then it started to get stuck in the processEvent() call and generate other erratic behaviors.

              mhhh...

              anyway: fix your code and make it async.

              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
              0

              • Login

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