Results 1 to 4 of 4

Thread: Overlapping windows on Mac OS X

  1. #1
    Join Date
    Feb 2011
    Posts
    354
    Thanks
    17
    Thanked 27 Times in 24 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Default Overlapping windows on Mac OS X

    I am trying to implement a starup banner that should be shown above the main application window. It works fine on Windows, but on Mac OS X I can't get two windows shown at the same time (unless I show the banner after a some large time interval). Is there a way to ensure the window is visible on the screen before showing another one?

    This is how I tried it:
    Qt Code:
    1. #include <QApplication>
    2.  
    3. #include "mainwindow.h"
    4. #include "banner.h"
    5.  
    6. int main(int argc, char * argv[])
    7. {
    8. QApplication app(argc, argv);
    9.  
    10. MainWindow mainWindow;
    11. mainWindow.show();
    12. //mainWindow.raise();
    13.  
    14. Banner banner;
    15. //QTimer::singleShot(0, &banner, SLOT(show()));
    16. //QTimer::singleShot(0, &banner, SLOT(raise()));
    17. banner.show();
    18.  
    19. return app.exec();
    20. }
    To copy to clipboard, switch view to plain text mode 

    I tried to use show, raise, delayed show/raise with zero-time interval, but nothing helps: still I see only the banner window when the application is launched, the main window becomes visible only when I click the application icon on the task bar.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Overlapping windows on Mac OS X

    Have you seen QSplashScreen?

  3. #3
    Join Date
    Feb 2011
    Posts
    354
    Thanks
    17
    Thanked 27 Times in 24 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Default Re: Overlapping windows on Mac OS X

    Yes, I did, but that is different to what I really need. However, with QSplashScreen I also have only one window displayed: if I first show the splash screen it gets hidden by the main window when it shown, otherwise, I see only the splash screen while the main window is hidden - the behavior is wrong in both cases.

  4. #4
    Join Date
    Feb 2011
    Posts
    354
    Thanks
    17
    Thanked 27 Times in 24 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Default Re: Overlapping windows on Mac OS X

    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?

Similar Threads

  1. need help on how to detect overlapping circles
    By aya_lawliet in forum Qt Quick
    Replies: 6
    Last Post: 20th October 2011, 09:47
  2. Replies: 0
    Last Post: 1st September 2009, 10:23
  3. QGraphicsView overlapping items
    By juliarg in forum Newbie
    Replies: 1
    Last Post: 5th April 2007, 10:35
  4. overlapping QGraphicsItem problem!!
    By boss_bhat in forum Qt Programming
    Replies: 3
    Last Post: 28th January 2007, 12:36
  5. overlapping canvases
    By quickNitin in forum Newbie
    Replies: 11
    Last Post: 8th October 2006, 12:22

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.