diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2012-10-22 14:43:38 +0300 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-10-25 10:08:04 +0200 |
commit | 9fc7fcb4c90f9fdc5bb3581609a1d5b01cfb7076 (patch) | |
tree | 205dd5103662563949f9bea6ca7c85aea905a33c /src/plugins/platforms/windows/qwindowscontext.cpp | |
parent | 8e002f1c0e0e0605d6cdfb90cdf909035eb643c8 (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/plugins/platforms/windows/qwindowscontext.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowscontext.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 3d4871d7a2..42db58ae6c 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -869,6 +869,11 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, QWindowsWindow::baseWindowOf(modalWindow)->alertWindow(); break; #endif +#ifndef QT_NO_CONTEXTMENU + case QtWindows::ContextMenu: + handleContextMenuEvent(platformWindow->window(), msg); + return true; +#endif default: break; } @@ -900,6 +905,24 @@ void QWindowsContext::handleFocusEvent(QtWindows::WindowsEventType et, } } +#ifndef QT_NO_CONTEXTMENU +void QWindowsContext::handleContextMenuEvent(QWindow *window, const MSG &msg) +{ + bool mouseTriggered = false; + QPoint globalPos; + QPoint pos; + if (msg.lParam != (int)0xffffffff) { + mouseTriggered = true; + globalPos.setX(msg.pt.x); + globalPos.setY(msg.pt.y); + pos = QWindowsGeometryHint::mapFromGlobal(msg.hwnd, globalPos); + } + + QWindowSystemInterface::handleContextMenuEvent(window, mouseTriggered, pos, globalPos, + QWindowsKeyMapper::queryKeyboardModifiers()); +} +#endif + /*! \brief Windows functions for actual windows. |