Widget stays on top of the qt application
-
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.
-
@TanteDroll
Do you need 2QMainWindow
s (or any otherQWidget
, there is nothing special aboutQMainWindow
)? Did you consider, say, oneQMainWindow
holding aQStackedWidget
for your current other two widgets? -
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. -
@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.