Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Widget stays on top of the qt application

    General and Desktop
    3
    5
    237
    Loading More Posts
    • 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.
    • T
      TanteDroll last edited by

      Hi everyone,
      i have currently the following problem:

      I have two QMainWindows 'A' and 'B' which both have no parent so they are independent widgets. Now i have a third non modal widget 'C' which should stay on top of widget A and B.

      Is there any way to tell a widget to stay on top of all other widgets but only of this application? I only found the flag Qt::WindowStaysOnTopHint but by unsing this flag the widget will stay on top of every other window of other application too.

      JonB 1 Reply Last reply Reply Quote 0
      • JonB
        JonB @TanteDroll last edited by

        @TanteDroll
        Do you need 2 QMainWindows (or any other QWidget, there is nothing special about QMainWindow)? Did you consider, say, one QMainWindow holding a QStackedWidget for your current other two widgets?

        T 1 Reply Last reply Reply Quote 0
        • Chris Kawa
          Chris Kawa Moderators last edited by Chris Kawa

          The only mean to control this is via parent-child relation but a widget can't have two parents so there's no direct way to do this.
          Some workarounds would be to have one main window become a parent of the other. Another one could be switching parent main window e.g. when any of them gets focus or some such tricks.

          T 1 Reply Last reply Reply Quote 4
          • T
            TanteDroll @JonB last edited by

            @JonB Yes in this case it is necessary but thank you for your reply

            1 Reply Last reply Reply Quote 0
            • T
              TanteDroll @Chris Kawa last edited by

              @Chris-Kawa Ok, I wanted to be sure that i diddn't miss any qt option. I guess i have to make a concept to assign the parent dynamicly. Thanks for the help.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post