Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QDialog with Qt::WindowModal on mac



  • I need a blocking QDialog (the main app below should be inactive while it is shown) which is able to display sub-windows on top of it. I'm using this QDialog to display VST plugins, which are free to create multiple sub-windows if needed.

    If I set it ApplicationModal, the QDialog is displayed fine, but any sub-windows is shown under the QDialog and therefore cannot be used.
    enter image description here
    ApplicationModal QDialog with no plugin shown
    enter image description here
    ApplicationModal QDialog with a plugin trying to show a sub-window (displayed behind the QDialog and inaccessible)

    If I set it WindowModal, the sub-windows display and works as expected (on top of the QDialog), but the QDialog itself looks weird : it shares its title bar with the main application, and cannot be moved without moving the whole application.
    enter image description here
    WindowModal QDialog with no plugin shown; notice the title bar shared with the main application
    enter image description here
    WindowModal QDialog with a plugin showing a sub-window on top, as expected

    So... I'm kinda stuck here. Is there a way to make a QDialog WindowModal while keeping its own title bar and freedom of movement over the main application, like the ApplicationModal dialog does ?

    I'm using Qt 5.15 on macOS Catalina.


  • Lifetime Qt Champion

    Hi,

    WindowModal and ApplicationModal are two different concepts. AFAIK, on macOS, the style for window modal dialog is to be shown as sheets like you see there.



  • Ah, so it's by design and can't be tweaked.
    In that case, do you know if I can show my dialog as non-modal (because it allows plugins to create sub-windows as expected) but somehow block the input events from my main window while this dialog is shown ? So it would act like a modal dialog, but I would handle the blocking/unblocking of the main window manually.


Log in to reply