vcl/qt5/Qt5Graphics_Controls.cxx | 6 +++++- vcl/qt5/Qt5Instance.cxx | 2 ++ vcl/qt5/Qt5Widget.cxx | 8 +++++--- 3 files changed, 12 insertions(+), 4 deletions(-)
New commits: commit 6830aa8962116601f22542944e196242207068c7 Author: Jan-Marek Glogowski <glo...@fbihome.de> AuthorDate: Thu Jun 6 02:55:22 2019 +0000 Commit: Jan-Marek Glogowski <glo...@fbihome.de> CommitDate: Sat Jun 22 17:09:13 2019 +0200 Qt5 fix some broken RTL handling For RTL decisions we always use Qt's own setting after setting it on startup using QGuiApplication::setLayoutDirection. The only difference between LO and Qt events is the mirrored cursor position, which needs explicit mirroring before reporting mouse based events (mouse and wheel). Tooltips and frame positioning will be handled in separate patches. Additionally the horizontal scroll bar direction hack based on the scroll bar button positions, needs to handle RTL explicitly. Change-Id: I5ce5e69113a6cb6a9cf37a449265c49d92a7c159 Reviewed-on: https://gerrit.libreoffice.org/74545 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de> (cherry picked from commit 1795adce52b614cc6f12ea313f1c377fefbf2351) Reviewed-on: https://gerrit.libreoffice.org/74564 diff --git a/vcl/qt5/Qt5Graphics_Controls.cxx b/vcl/qt5/Qt5Graphics_Controls.cxx index 4cc108f55043..c8f706901ae7 100644 --- a/vcl/qt5/Qt5Graphics_Controls.cxx +++ b/vcl/qt5/Qt5Graphics_Controls.cxx @@ -494,7 +494,11 @@ bool Qt5Graphics_Controls::drawNativeControl(ControlType type, ControlPart part, option.sliderPosition = sbVal->mnCur; option.pageStep = sbVal->mnVisibleSize; if (part == ControlPart::DrawBackgroundHorz) - option.upsideDown = sbVal->maButton1Rect.Left() > sbVal->maButton2Rect.Left(); + option.upsideDown + = (QGuiApplication::isRightToLeft() + && sbVal->maButton1Rect.Left() < sbVal->maButton2Rect.Left()) + || (QGuiApplication::isLeftToRight() + && sbVal->maButton1Rect.Left() > sbVal->maButton2Rect.Left()); //setup the active control... always the slider if (sbVal->mnThumbState & ControlState::ROLLOVER) diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx index 556e8a640148..0494720b5740 100644 --- a/vcl/qt5/Qt5Instance.cxx +++ b/vcl/qt5/Qt5Instance.cxx @@ -246,6 +246,8 @@ void Qt5Instance::AfterAppInit() // as this otherwise overrides the individual desktop icons on X11. if (QGuiApplication::platformName() == "wayland") QGuiApplication::setDesktopFileName(QStringLiteral("libreoffice-startcenter.desktop")); + QGuiApplication::setLayoutDirection(AllSettings::GetLayoutRTL() ? Qt::RightToLeft + : Qt::LeftToRight); } void Qt5Instance::deleteObjectLater(QObject* pObject) { pObject->deleteLater(); } diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx index b46b48b35366..4513ab99b84a 100644 --- a/vcl/qt5/Qt5Widget.cxx +++ b/vcl/qt5/Qt5Widget.cxx @@ -140,7 +140,9 @@ void Qt5Widget::handleMouseButtonEvent(const Qt5Frame& rFrame, QMouseEvent* pEve } aEvent.mnTime = pEvent->timestamp(); - aEvent.mnX = static_cast<long>(pEvent->pos().x()); + aEvent.mnX = static_cast<long>(QGuiApplication::isLeftToRight() + ? pEvent->pos().x() + : rFrame.GetQWidget()->width() - pEvent->pos().x()); aEvent.mnY = static_cast<long>(pEvent->pos().y()); aEvent.mnCode = GetKeyModCode(pEvent->modifiers()) | GetMouseModCode(pEvent->buttons()); @@ -165,7 +167,7 @@ void Qt5Widget::mouseMoveEvent(QMouseEvent* pEvent) SalMouseEvent aEvent; aEvent.mnTime = pEvent->timestamp(); - aEvent.mnX = point.x(); + aEvent.mnX = QGuiApplication::isLeftToRight() ? point.x() : width() - point.x(); aEvent.mnY = point.y(); aEvent.mnCode = GetKeyModCode(pEvent->modifiers()) | GetMouseModCode(pEvent->buttons()); aEvent.mnButton = 0; @@ -190,7 +192,7 @@ void Qt5Widget::wheelEvent(QWheelEvent* pEvent) aEvent.mbHorz = nDelta == 0; if (aEvent.mbHorz) { - nDelta = pEvent->angleDelta().x(); + nDelta = (QGuiApplication::isLeftToRight() ? -1 : 1) * pEvent->angleDelta().x(); if (!nDelta) return; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits