summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2013-12-12 12:48:29 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-12 13:58:48 +0100
commit4f8a92b738e29f93c01d0be70c8e5e7686af94b0 (patch)
treecf0d8e96dbbb180612477653efd1c35f9cf99c91
parent9bd1e4c7e850667f31c6a1333a95b5baeb9998e3 (diff)
Fix scroll-bar behavior in RTL layout
Default to application layout direction when no widget is given, and reverse meaning of position for horizontal RTL scrollbars. Task-numer: QTBUG-28256 Change-Id: I09c49f5d104fd0b9a6b4b1cda5c754712fc26087 Reviewed-by: Michael Bruning <michael.bruning@digia.com> Reviewed-by: Andras Becsi <andras.becsi@digia.com>
-rw-r--r--Source/WebCore/platform/qt/ScrollbarThemeQStyle.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/Source/WebCore/platform/qt/ScrollbarThemeQStyle.cpp b/Source/WebCore/platform/qt/ScrollbarThemeQStyle.cpp
index f89945771..d8c440b90 100644
--- a/Source/WebCore/platform/qt/ScrollbarThemeQStyle.cpp
+++ b/Source/WebCore/platform/qt/ScrollbarThemeQStyle.cpp
@@ -34,6 +34,8 @@
#include "ScrollView.h"
#include "Scrollbar.h"
+#include <QGuiApplication>
+
namespace WebCore {
ScrollbarThemeQStyle::ScrollbarThemeQStyle()
@@ -93,8 +95,10 @@ static QStyleFacadeOption initSliderStyleOption(ScrollbarThemeClient* scrollbar,
opt.palette = widget->property("palette").value<QPalette>();
opt.rect = widget->property("rect").value<QRect>();
opt.direction = static_cast<Qt::LayoutDirection>(widget->property("layoutDirection").toInt());
- } else
+ } else {
opt.state |= QStyleFacade::State_Active;
+ opt.direction = QGuiApplication::layoutDirection();
+ }
opt.state &= ~QStyleFacade::State_HasFocus;
@@ -116,6 +120,8 @@ static QStyleFacadeOption initSliderStyleOption(ScrollbarThemeClient* scrollbar,
opt.slider.singleStep = scrollbar->lineStep();
opt.slider.minimum = 0;
opt.slider.maximum = qMax(0, scrollbar->maximum());
+ if (opt.slider.orientation == Qt::Horizontal && opt.direction == Qt::RightToLeft)
+ opt.slider.upsideDown = true;
ScrollbarPart pressedPart = scrollbar->pressedPart();
ScrollbarPart hoveredPart = scrollbar->hoveredPart();
if (pressedPart != NoPart) {