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

Custom events are processed only after the first ::processEvents

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 4.6.0
    • 4.5.1
    • Core: Event loop
    • None
    • b0016ea9a6b225757e3ee06b50e8f7d05463ddf7, ea0c0dfa64f5c614bfd728f323d9b6731ee4898c

    Description

      On Mac OS X, QCoreApplication::processEvents() must be called once before any custom events can be processed. Some tests fail because of that.

      #include <QtGui>
      
      class Object : public QObject {
          Q_OBJECT
      public:
      signals:
          void signal();
      
      public:
          void emitSignal() { emit signal(); }
      private slots:
          void slot() {
              qDebug("slot called");
          }
      };
      
      #include "main.moc"
      
      int main(int argc, char **argv) {
        QApplication app(argc, argv);
        Object object;
        QObject::connect(&object, SIGNAL(signal()), &object, SLOT(slot()), Qt::QueuedConnection);
        object.emitSignal();
        qDebug("processEvents 1");
        QCoreApplication::processEvents();
        qDebug("processEvents 2");
        QCoreApplication::processEvents();
        object.emitSignal();;
        qDebug("processEvents 3");
        QCoreApplication::processEvents();
        return 0;
      }
      

      Attachments

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

        Activity

          People

            wallison Warwick Allison (closed Nokia identity) (Inactive)
            poulain Benjamin Poulain (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes