How to make window stay behind other windows ?
I'm new in Qt. I have a fairly easy question that i cannot solve myself .
I'm creating 5 windows (desktop, Leftbar, Rightbar, Leftbar, Bottombar, Topbar), i want to desktop window always stay bottom of other 4 window. When i click anywhere on desktop window other windows should continue to stay on top. How can i do this ?
@int main(int argc, char *argv)
QApplication a(argc, argv);
Desktop desktop; desktop.show(); Leftbar leftbar; leftbar.show(); Rightbar rightbar; rightbar.show(); Topbar topbar; topbar.show(); Bottombar bottombar; bottombar.show(); return a.exec();
Hey there, welcome to Qt!
Check out theses posts :
Thank you for your answer, but when i use
on leftbar, rightbar, topbar and bottombar they stay on top of all windows (like when i open documents folder these windows continue to stay on top).
I want these windows stay top of my "desktop" window, not all windows.
I would put
on the Desktop window and not worry about the others.
I already put
Qt::WindowStaysOnBottomHint on the desktop window,
but it's not working. When i click on desktop window, other windows(Leftbar, Rightbar, Leftbar, Bottombar, Topbar) go bottom of desktop window.
For more complex behavior,
You can subclass QWidget and reimplement focusInEvent and/or focusOutEvent to emit your custom signal, then process another Slot in another QWidget.
for example, when focus is received on desktop, put another QWidget above (with raise()) or under it(lower()).