[SOLVED] How to get a modal window to display on top of another window?



  • I have a main window and a modal window. The modal window appears under the main window, not on top of the main window, when it is displayed. I tried using different flags and alternate ways of showing the modal window but none made any difference.

    In Main.qml:
    @
    . . .
    Item{
    id: container

    visible: true

    ModalWindow{
    id: modal_window

    visible: false
    

    }

    Component.onCompleted: {
    . . .
    modal_window.visible = true;
    . . .
    }
    . . .
    }
    @

    in ModalWindow.qml:
    @
    . . .
    Window{
    . . .
    flags: {Qt.Dialog, Qt.WindowStaysOnTopHint}
    modality: Qt.WindowModal
    . . .
    }
    @

    Any suggestions?

    Thanks.

    Steve



  • Changing
    @{Qt.Dialog, Qt.WindowStaysOnTopHint}@

    to
    @{Qt.Dialog; Qt.WindowStaysOnTopHint}@

    seems to solve the problem



  • Regarding syntax of flags: this field expects a bit-map of flags, so to apply both Qt.Dialog and Qt.WindowStaysOnTopHint, the syntax would be:
    @flags: QtDialog | Qt.WindowStaysOnTopHint@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.