diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-03-28 11:22:09 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-05-22 14:23:33 +0200 |
commit | f48aa008e992429647968a29ef30d412f1ae379a (patch) | |
tree | 84115e4f8d3da97865d0d48f57ea6e48dab4b2ae /src/plugins/platforms/windows/qwindowspointerhandler.cpp | |
parent | 26a0db4b441a74cb65410635c3e8608a6360c793 (diff) |
Windows QPA: Fix RTL window title bars
Add a platform option to the plugin (-platform windows:reverse) that
enables reverse mode. It sets WS_EX_LAYOUTRTL on RTL windows, forces normal
orientation on all HDCs created for the window, fixes
ClientToScreen()/ScreenToClient() accordingly and transforms mouse events.
[ChangeLog][Platform Specific Changes][Windows] It is now possible
to enable RTL mode by passing the option -platform windows:reverse.
Fixes: QTBUG-28463
Change-Id: I4d70818b2fd315d4e8d5627eab11ae912c6e77be
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowspointerhandler.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowspointerhandler.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/src/plugins/platforms/windows/qwindowspointerhandler.cpp index b730dbcf3b..0e686bfb10 100644 --- a/src/plugins/platforms/windows/qwindowspointerhandler.cpp +++ b/src/plugins/platforms/windows/qwindowspointerhandler.cpp @@ -688,7 +688,13 @@ bool QWindowsPointerHandler::translateMouseEvent(QWindow *window, { *result = 0; - const QPoint eventPos(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam)); + QPoint eventPos(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam)); + if ((et & QtWindows::NonClientEventFlag) == 0 && QWindowsBaseWindow::isRtlLayout(hwnd)) { + RECT clientArea; + GetClientRect(hwnd, &clientArea); + eventPos.setX(clientArea.right - eventPos.x()); + } + QPoint localPos; QPoint globalPos; |