[WIP] workarounds for menu positioning
Summary: this ensure two things: * submenus have the main menu as transientParent * the visualParent window() is used as transientParent, if exists this partly fixes popup positioning in wayland, tough the main taskbar menu is still mis positioned Test Plan: submenus ok, taskbar contextmenus only partially fixed Reviewers: #plasma, #plasma_on_wayland, davidedmundson Reviewed By: #plasma, davidedmundson Subscribers: davidedmundson, plasma-devel, #frameworks Tags: #frameworks, #plasma_on_wayland Differential Revision: https://phabricator.kde.org/D5773
This commit is contained in:
parent
fd2e850156
commit
680a8a9e28
@ -290,6 +290,12 @@ void QMenuProxy::rebuildMenu()
|
||||
m_menu->addSection(item->text());
|
||||
} else {
|
||||
m_menu->addAction(item->action());
|
||||
if (item->action()->menu()) {
|
||||
//This ensures existence of the QWindow
|
||||
m_menu->winId();
|
||||
item->action()->menu()->winId();
|
||||
item->action()->menu()->windowHandle()->setTransientParent(m_menu->windowHandle());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -418,6 +424,20 @@ Q_INVOKABLE void QMenuProxy::openRelative()
|
||||
|
||||
void QMenuProxy::openInternal(QPoint pos)
|
||||
{
|
||||
QQuickItem *parentItem = nullptr;
|
||||
|
||||
if (m_visualParent) {
|
||||
parentItem = qobject_cast<QQuickItem *>(m_visualParent.data());
|
||||
} else {
|
||||
parentItem = qobject_cast<QQuickItem *>(parent());
|
||||
}
|
||||
|
||||
if (parentItem && parentItem->window()) {
|
||||
//create the QWindow
|
||||
m_menu->winId();
|
||||
m_menu->windowHandle()->setTransientParent(parentItem->window());
|
||||
}
|
||||
|
||||
m_menu->popup(pos);
|
||||
m_status = DialogStatus::Open;
|
||||
emit statusChanged();
|
||||
|
Loading…
Reference in New Issue
Block a user