mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-12 00:58:18 +03:00
fix Canvas context menu issues
--fix a crash when using left click in Canvas window --fix blocking View when switching for editMode to inConfigureApplets mode and vice versa
This commit is contained in:
parent
a4445a3e9a
commit
6a4aeb16f0
@ -157,28 +157,23 @@ bool ContextMenu::mousePressEventForContainmentMenu(QQuickView *view, QMouseEven
|
||||
event->setAccepted(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_latteView->containment()) {
|
||||
QMenu *desktopMenu = new QMenu;
|
||||
desktopMenu->setAttribute(Qt::WA_TranslucentBackground);
|
||||
|
||||
if (desktopMenu->winId()) {
|
||||
desktopMenu->windowHandle()->setTransientParent(view);
|
||||
desktopMenu->windowHandle()->setTransientParent(m_latteView);
|
||||
}
|
||||
|
||||
desktopMenu->setAttribute(Qt::WA_DeleteOnClose);
|
||||
m_contextMenu = desktopMenu;
|
||||
emit menuChanged();
|
||||
|
||||
auto ungrabMouseHack = [this, view]() {
|
||||
auto ungrabMouseHack = [this]() {
|
||||
if (m_latteView->mouseGrabberItem()) {
|
||||
m_latteView->mouseGrabberItem()->ungrabMouse();
|
||||
}
|
||||
|
||||
if (view->mouseGrabberItem()) {
|
||||
view->mouseGrabberItem()->ungrabMouse();
|
||||
}
|
||||
};
|
||||
|
||||
if (QVersionNumber::fromString(qVersion()) > QVersionNumber(5, 8, 0)) {
|
||||
@ -211,6 +206,7 @@ bool ContextMenu::mousePressEventForContainmentMenu(QQuickView *view, QMouseEven
|
||||
event->setAccepted(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ private:
|
||||
|
||||
|
||||
private:
|
||||
QMenu *m_contextMenu{nullptr};
|
||||
QPointer<QMenu> m_contextMenu;
|
||||
QMetaMethod m_appletContainsMethod;
|
||||
QQuickItem *m_appletContainsMethodItem{nullptr};
|
||||
|
||||
|
@ -125,6 +125,7 @@ void CanvasConfigView::mousePressEvent(QMouseEvent *event)
|
||||
bool result = m_latteView->contextMenu()->mousePressEventForContainmentMenu(this, event);
|
||||
|
||||
QQuickView::mousePressEvent(event);
|
||||
|
||||
}
|
||||
|
||||
bool CanvasConfigView::event(QEvent *e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user