Important: Please read the Qt Code of Conduct -

QDialog showFullScreen - different behavior MacOSX

  • Hi,

    Sorry for posting again, probably my last question! I am porting my app to MacOSX and i'm almost done :)
    I have one last problem with a custom QDialog.

    I am opening a custom QDialog with :
    @ WorkoutDialog w;

    Results in :

    But the result is not what I would like in MacOS, the windows is not maximized, I would like it to take fullscreen, like on windows7, is it possible to do that on MacOS with some other function? I have looked but haven't found yet. Thanks in advance!

  • Lifetime Qt Champion


    Which version of Qt are you using on which version of OS X ?

  • Hi this is the latest version 5.2.1 on OS X Mavericks (in VMware)

    The QQialog appear in the center of the QMainWindow always with the same size (even if QMainWindow is maximized), you can resize it manually to fullscreen but it has to be done each time.


  • It is not a major problem.. maybe I could save the geometry when the user close the QDialog, and on a re-open, try to force the QDialog back to it's old value, will try and post result

  • Lifetime Qt Champion

    I just tried with Parallels and it looks like it might be a Mavericks specific bug. You should check the "bug report system": to see whether it's something known. If not please open a new report with a minimal compilable example.

  • Thans SGaist,

    I created a bug report there :

    Meanwhile I think I can workaround with using another type of widget (not QDialog) or be setting manually it's size.

  • Note that the first (primary) window in your app can be fullscreen (even in Mavericks), it's just that 2nd screen (your QDialog) that cannot obtain fullscreen so easy.
    When you look at the window class names, main app window that main.cpp launches gets QNSView and then a QNSWindow (fine and dandy for fullscreen), but the QDialog gets QNSView and then a QNSPanel :-( If you look at docs about NSPanel, Apple says it's behavior is more "restricted".

    So It might be a bug as SGaist suggests. But I've noticed that Apple has changed some of the fullscreen behavior in Mavericks when you have more than one display. So maybe this is "behavior by design" (as Microsoft's support sometimes answers bug reports).

    Anyway, as a workaround, consider instead of launching a QDialog in your app, you could launch a 2nd app having the QDialog's contents in its main window, that way you could go fullscreen.

  • Lifetime Qt Champion

    You're welcome !

    Seems that it's already been solved. In between you can set the geometry using the QDesktopWidget

  • Aha good! It really shows Qt's power, you can solve these kinds of problems in more than one way..

  • BTW (off topic) I just read the Qt will have support for WinRT and Windows Phone. Well I usually compare Microsoft's MFC with Qt, both are about 20 years old and many things are similarly designed.
    But you cannot (and I think probably never) bulld WinRT and Windows Phone apps in MFC. So when you can do this in Qt, you've beaten Microsoft for sure :-)

  • Qt FTW!

    Now to find how to hide OSX toolbar and dock when in fullscreen.. :)

    @ w.setModal(true);
    QDesktopWidget wid;

  • Hiding the OSX toolbar and the dock, sure, that's the real McCoy.
    And it's easy for your app's first (primary) window (in Mavericks).
    Not so easy when you try with your QDialog's window :-(

  • My QDialog has access to his parent,
    so I could call parent->(whateverfunctionHideToolbar) :)

  • Good! In that case, call parent's (i.e. your main app window) showFullScreen() just before you do w.setGeometry(wid.screenGeometry());

    That way you "borrow" the full screen characteristics from you main app window, and the QDialog will go fullscreen too :-)

  • Thanks for your suggestion.
    Now if I set the MainWindow in fullscreen it works, but how to unset it after the QDialog has been closed? I feel this is getting a bit to hacky for me.. I may try an alternate solution like using a QMainWindow instead of a QDialog

    @ qDebug() << "OK set MainWindow fullscreen \n\n";
    QDesktopWidget wid;

  • Hacky, agreed. That's because maybe here you're not going the Apple way™

    Try QMainWIndow and if it's not nice as well, you can always resort to my idea in the post above, i.e. your main app launches another app instead of a new window.

  • Thanks for the suggestion but using multiple qApp is not acceptable for me since I store global variable in the system and this could create a mess in my code.
    i.e: app.setProperty("User", QVariant::fromValue<User*>(user));
    I'm not sure of the "Apple way" yet, i just recently started using a mac and I feel it's an overpriced linux with a cute gui.

    SGaist, is Alpha 5.3.0 available to public or do we have access to source code in the patch?
    Thank you for the fast support <3 Qt

  • Lifetime Qt Champion

    Both are available, but it simpler to download the source for Alpha 5.3.0 "here":

Log in to reply