summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qguiapplication.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qguiapplication.cpp')
-rw-r--r--src/gui/kernel/qguiapplication.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index a67917ca3b..64d2f8001f 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1211,6 +1211,12 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
QGuiApplicationPrivate::processFileOpenEvent(
static_cast<QWindowSystemInterfacePrivate::FileOpenEvent *>(e));
break;
+#ifndef QT_NO_CONTEXTMENU
+ case QWindowSystemInterfacePrivate::ContextMenu:
+ QGuiApplicationPrivate::processContextMenuEvent(
+ static_cast<QWindowSystemInterfacePrivate::ContextMenuEvent *>(e));
+ break;
+#endif
default:
qWarning() << "Unknown user input event type:" << e->type;
break;
@@ -1639,6 +1645,19 @@ void QGuiApplicationPrivate::processPlatformPanelEvent(QWindowSystemInterfacePri
QGuiApplication::sendSpontaneousEvent(e->window.data(), &ev);
}
+#ifndef QT_NO_CONTEXTMENU
+void QGuiApplicationPrivate::processContextMenuEvent(QWindowSystemInterfacePrivate::ContextMenuEvent *e)
+{
+ // Widgets do not care about mouse triggered context menu events. Also, do not forward event
+ // to a window blocked by a modal window.
+ if (!e->window || e->mouseTriggered || e->window->d_func()->blockedByModalWindow)
+ return;
+
+ QContextMenuEvent ev(QContextMenuEvent::Keyboard, e->pos, e->globalPos, e->modifiers);
+ QGuiApplication::sendSpontaneousEvent(e->window.data(), &ev);
+}
+#endif
+
Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k)
{
return qHash(k.device) + k.touchPointId;