PDA

View Full Version : Full Screen window with separate window widget on top



Linwood
14th January 2017, 02:33
In linux (only place I care at the moment) I have an application that runs in full screen (showFullScreen() used in MainWindow) and works fine.

I want to add, to one aspect of its run time, a floating window that is a control. I am creating it as a regular QWidget class, owned by the parent MainWindow, then in that widget's constructor doing:

this->setWindowFlags(Qt::Window);

to force it to a separate window.

When I am not using full screen, this works fine -- the new widget opens in its own window, with border (I use the "X" on it), and it stays on top of it's parent.

But when the MainWindow is full screen, it opens behind it, where it is inaccessible.

I am not even sure if what I want is possible -- can I have a window that is full screen, AND have another window open on top of it?

If so, suggestions which combination of flags?

I've tried quite a few without success, the only one that works is Qt::X11BypassWindowManagerHint, but that leaves it without a border or controls so it is stuck in one place -- I need it to be movable. The best analogy is something like a FIND window that stays in front and you can reposition over a full screen document.

anda_skoa
14th January 2017, 11:13
Have you tried using a QDialog instead of QWidget?

Cheers,
_

Linwood
14th January 2017, 14:02
Hmmm, in a quick try it does seem to work (I just OR'd it into the window flags).

I did not try that originally as I thought it locked in the behavior as a accept/reject type screen, but so far I have not seen any (other) differences. Maybe because I set the flag instead of using the class, but thank you, this seems to solve the problem.

anda_skoa
15th January 2017, 10:39
QDialog can be used as an accept/reject type window. This mode is called "modal".
But it can also be just used as a normal sub window.

Setting the dialog flag on a normal window is fine as well, in both cases it is a hint to the windowing system that the window should be kept on top of its parent.

Cheers,
_