summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qguiapplication.cpp
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2012-10-22 14:43:38 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-25 10:08:04 +0200
commit9fc7fcb4c90f9fdc5bb3581609a1d5b01cfb7076 (patch)
tree205dd5103662563949f9bea6ca7c85aea905a33c /src/gui/kernel/qguiapplication.cpp
parent8e002f1c0e0e0605d6cdfb90cdf909035eb643c8 (diff)
Add ContextMenu event to QWindowSystemInterface
Context menu key wasn't working, as QPA had no handling for it. Added ContextMenu event to QWindowSystemInterface and proper handling to QGuiApplication and QWidgetWindow. Also provide Windows implementation. Task-number: QTBUG-27648 Change-Id: I7ce71ec4b5cdcc7be758e67f9faf6d863f7b19be Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
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;