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. Qml windows appearance
Qt 6.11 is out! See what's new in the release blog

Qml windows appearance

Scheduled Pinned Locked Moved General and Desktop
qmlwindowstop
2 Posts 1 Posters 1.5k 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.
  • P Offline
    P Offline
    pavelvasev
    wrote on last edited by pavelvasev
    #1

    Hi all!

    I have a main window of my app. Then, I want to show some non-modal sub-window.

    It should be shown always above the main window of my app, but not above all windows on desktop, and it should minimize/hide when main window is minimized.

    When I use flags: Qt.Dialog | Qt.WindowStaysOnTopHint for sub-window, it is shown always above the main window, which is what I want... But there are side effects, e.g. with that flags my sub-window is shown:

    • above all other windows in the system.
    • above ongoing MessageDialogs and FileDialogs of my app.

    Tha latter is a main trouble. Because user might never see some MessageDialog. And in case it is app-modal, the whole app become blocked! :-/ Same trouble for FileDialog - it is comfortless to choose files when FileDialog is covered by some other window.

    Could you please suggest me how to configure my qml sub-window to eliminate stated side effects? I even may call some c++ code, even specific to Windows, to achieve the desired behaviour.

    Many thanks a lot. My Qt version is 5.3.1

    1 Reply Last reply
    0
    • P Offline
      P Offline
      pavelvasev
      wrote on last edited by pavelvasev
      #2

      I found the root of the problem.

      Sub-window objects were defined inside MenuBar object. Sitting there, they were unable to find transient parent window (e.g main window of the app), and behaved like ordinal top-level windows, same as main window.

      I checked 2 cases: MenuBar is declared as a children inside some item inside main window, and as a property value. In both cases transient parent window was not founded. It seems MenuBar is a some kind of special object which breaks the transient parent search algorithm.

      The solution was to place sub-window objects as child objects to some other better item, probably right inside main window.

      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