summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Bache-Wiig <jbache@trolltech.com>2010-05-04 13:14:56 (GMT)
committerSamuli Piippo <samuli.piippo@digia.com>2011-06-09 10:05:50 (GMT)
commita82b07239926b9d28bb581804d03fb2084c33cf5 (patch)
tree84ce8e918d873ebb14ce1ff8957e60cac198b5dd
parentd1f5fd81a90c012cc8dcf88d092c8e24422dc9db (diff)
downloadQt-a82b07239926b9d28bb581804d03fb2084c33cf5.zip
Qt-a82b07239926b9d28bb581804d03fb2084c33cf5.tar.gz
Qt-a82b07239926b9d28bb581804d03fb2084c33cf5.tar.bz2
Fix rtl issues with sliders in GTK style
Sliders that draw groove decorations did not invert appearance correctly in vertical or rtl cases. With this fix we will flip the rectangles of the respective decorations and tell gtk if we are using an rtl widget or not. Task-number: QTBUG-8986 Reviewed-yb: thorbjorn (cherry picked from commit d52cc1ded5f30a6da0d11b9c3f7de66b2d3e9ee9)
-rw-r--r--src/gui/styles/qgtkstyle.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index 5b5df9b..4aa8f9f 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -1916,14 +1916,11 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget);
QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget);
- QRect ticks = proxy()->subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);
bool horizontal = slider->orientation == Qt::Horizontal;
bool ticksAbove = slider->tickPosition & QSlider::TicksAbove;
bool ticksBelow = slider->tickPosition & QSlider::TicksBelow;
- QColor activeHighlight = option->palette.color(QPalette::Normal, QPalette::Highlight);
- QPixmap cache;
QBrush oldBrush = painter->brush();
QPen oldPen = painter->pen();
@@ -1932,6 +1929,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
QColor highlightAlpha(Qt::white);
highlightAlpha.setAlpha(80);
+ QGtkStylePrivate::gtk_widget_set_direction(hScaleWidget, slider->upsideDown ?
+ GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
GtkWidget *scaleWidget = horizontal ? hScaleWidget : vScaleWidget;
style = scaleWidget->style;
@@ -1965,11 +1964,21 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
QRect lowerGroove = grooveRect;
if (horizontal) {
- upperGroove.setLeft(handle.center().x());
- lowerGroove.setRight(handle.center().x());
+ if (slider->upsideDown) {
+ lowerGroove.setLeft(handle.center().x());
+ upperGroove.setRight(handle.center().x());
+ } else {
+ upperGroove.setLeft(handle.center().x());
+ lowerGroove.setRight(handle.center().x());
+ }
} else {
- upperGroove.setBottom(handle.center().y());
- lowerGroove.setTop(handle.center().y());
+ if (!slider->upsideDown) {
+ lowerGroove.setBottom(handle.center().y());
+ upperGroove.setTop(handle.center().y());
+ } else {
+ upperGroove.setBottom(handle.center().y());
+ lowerGroove.setTop(handle.center().y());
+ }
}
gtkPainter.paintBox( scaleWidget, "trough-upper", upperGroove, state,