Search code examples
qtbackgroundblockapplicationwindow

Qt block ApplicationWindow in Background, if other is in Foreground


I'm working with QtQuick and created a settings-window (ApplicationWindow), which shows after click on the settings button. The problem is, that i can still click on the main-window. The settings-windows just goes behind the main-window and "disappeared", till i move the main-window. Can I block the Main-Window while settings-menu opened? Furthermore is there a possibility remove the minimze and maximize buttons of the settings-windows in qml? Thanks in advance!


Solution

  • The term that describes what you need is called Modality. You can set the window modality property, as explained here:

    http://qt-project.org/doc/qt-4.8/qt.html#WindowModality-enum

    Also, each Qt window has a type property, as explained here:

    http://qt-project.org/doc/qt-4.8/qt.html#WindowType-enum

    Set the type that fits you most.

    As both are regular QObject properties you can set them via QML.