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

Menu's do not show under OSX when qt is run without calling exec until a popup menu is invoked

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 4.7.0
    • 4.6.0
    • Widgets: Main Window
    • None
    • Mac OS X 10.5
    • macOS
    • ec452c7f31ffe53dc28763a80d517288ac3c118d

    Description

      So my application has its own event loop and I just integrate Qt into my event loop. This has been working fine for a while but just broke in 4.6. None of my menus show until I get a popup menu to show first. If I create a dummy event loop and have a single shot timer quit it the menus show fine. I see the same behavior with Cocoa and Carbon builds. I modified the examples/mainwindows/menus example to illustrate my point. The only file I modified was main.cpp.

       
      
      #include <QApplication>
      #include <QAbstractEventDispatcher>
      #include <QTimer>
      
      #include "mainwindow.h"
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
          MainWindow window;
          window.show();
      
      // If you uncomment the next three lines everything works as expected
      //     QEventLoop dummyLoop;
      //     QTimer::singleShot(0, &dummyLoop, SLOT (quit ()));
      //     dummyLoop.exec ();
      
          QAbstractEventDispatcher *ed = QAbstractEventDispatcher::instance ();
      
          do {
      
              QCoreApplication::sendPostedEvents (0, 0);
              QCoreApplication::processEvents ();
      
          } while (window.isVisible ());
      
      //    return app.exec();
      
          return 0;
      }
      

      There seems to be some sort of event that is not getting sent unless a QEventLoop::exec is called. If this is not a bug can you please let me know what I can do to get my code to work without having to ever call exec? Thanks.

      Attachments

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

        Activity

          People

            richard Richard Moe Gustavsen
            shillcock Scott Shillcock
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes