diff options
author | Jens Bache-Wiig <jbache@trolltech.com> | 2010-05-04 13:14:56 (GMT) |
---|---|---|
committer | Jens Bache-Wiig <jbache@trolltech.com> | 2010-05-04 13:17:50 (GMT) |
commit | d52cc1ded5f30a6da0d11b9c3f7de66b2d3e9ee9 (patch) | |
tree | 147dd69164062268194d8ad6f9cc6af2d9d74b02 | |
parent | 66f35b0dcf9c97060e9c732bfd5fbe035862dc20 (diff) | |
download | Qt-d52cc1ded5f30a6da0d11b9c3f7de66b2d3e9ee9.zip Qt-d52cc1ded5f30a6da0d11b9c3f7de66b2d3e9ee9.tar.gz Qt-d52cc1ded5f30a6da0d11b9c3f7de66b2d3e9ee9.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
-rw-r--r-- | src/gui/styles/qgtkstyle.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index e3ca8b2..0988fd8 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -1937,14 +1937,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(); @@ -1953,6 +1950,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; @@ -1986,11 +1985,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, |