Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-21049

processEvents processes only a single Event

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 4.7.2
    • None
    • X11 with QEventDispatcherGlib

    Description

      The documentation for QApplication::processEvents() states that it processes events "... until there are no more events to process". However, with the glib-based event loop, this is not true. QEventDispatcherGlib::processEvents calls g_main_context_iteration only once and returns.

      If this has been reported elsewhere, I was not able to find it. I really took some effort to dig up something, but these keywords appear in so many stack traces that it's impossible to google anything meaningful.

      In a legacy app that I dare not touch any more than absolutely necessary I have something like this:

      while (needsMoreWaiting()) {
        QApplication::processEvents();
        QThread::msleep(10);
      }
      

      This fails to keep up with handling mouse events, so moving the mouse excessively is a good way to send the application into blocked state for a few seconds. I need to use something like this now to get rid of this annyoing behavior:

      while (needsMoreWaiting()) {
      #if defined(Q_WS_X11)
        do {
          QApplication::processEvents();
        } while (QApplication::hasPendingEvents());
      #else
        QApplication::processEvents();
      #endif
        QThread::msleep(10);
      }
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              Unassigned Unassigned
              ringding Stefan Ring
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes