Fallback to focusWindow as transient parent
The wayland protocol requires Popup windows to have a transient parent set, in order to correctly position the window on the screen. In Qt, some popup menus don't have it, so they will appear misplaced in the screen. This adds an heuristic which makes transientParent() return the current application focus window, which is an approximation which won't be always correct, but seems to fix most applications Task-number: QTBUG-60932 Change-Id: Icec1e306d3f64f4f00ad735a8c2eedb99e85eabb Reviewed-by: Johan Helsing <johan.helsing@qt.io>
This commit is contained in:
parent
f41bd9c06e
commit
66af01b17f
@ -720,6 +720,8 @@ QWaylandWindow *QWaylandWindow::transientParent() const
|
||||
// events.
|
||||
if (auto transientParent = window()->transientParent())
|
||||
return static_cast<QWaylandWindow *>(topLevelWindow(transientParent)->handle());
|
||||
else if (QGuiApplication::focusWindow() && (window()->type() == Qt::ToolTip || window()->type() == Qt::Popup))
|
||||
return static_cast<QWaylandWindow *>(topLevelWindow(QGuiApplication::focusWindow())->handle());
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user