I've found the code that seems to be related to the issue I am pointing out:
Qt Code:
  1. #ifdef Q_WS_X11
  2. void qt_x11_wait_for_window_manager(QWidget *widget);
  3. #endif
  4.  
  5. int main(int argc, char *argv[])
  6. {
  7. QApplication app(argc, argv);
  8. ...
  9. window.show();
  10. #ifdef Q_WS_X11
  11. qt_x11_wait_for_window_manager(&window);
  12. #endif
  13. ...
  14. return app.exec();
  15. }
To copy to clipboard, switch view to plain text mode 

According to the documentation, qt_x11_wait_for_window_manager blocks until the X11 window manager has shown the widget after a call to QWidget::show(). That is exactly what I need to fix the wrong behavior. Is it possible to do something similar on Mac OS X?