[Interest] Qt Widgets on Windows: set parent window, but NOT on top?
sergio.martins at kdab.com
Tue Nov 24 11:53:24 CET 2020
On 2020-11-24 00:44, David M. Cotter wrote:
> i have a main window with the menu bar
> then a secondary, separate window.
> since i want both windows to come to front when the user switches into
> it, and i also want the key shortcuts from the menubar to function in
> the second window, i set the parent of the 2nd window to the main
> window. doing so fixes both problems.
> however, when i do that, the 2nd window is ALWAYS on top of the main
> window, which i do not want
> the "always on top" flag of the 2nd window is NOT set.
> how do i fix this?
The shortcut behaviour comes QWidget::parentWidget(), while the "keep on
top" comes from QWindow::transientParent().
Since you only want the former, try setting a null transient parent:
And let's hope it doesn't unset the parentWidget
Sérgio Martins | sergio.martins at kdab.com | Senior Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel: Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - The Qt, C++ and OpenGL Experts
More information about the Interest