Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] How to get a modal window to display on top of another window?

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

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SteveG
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SteveG
      wrote on last edited by
      #2

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

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

      seems to solve the problem

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mraynelson
        wrote on last edited by
        #3

        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@

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved