From 2b7ce2612571f159838625aec2213c6c17a826c4 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 1 Dec 2009 21:04:59 +0000 Subject: [PATCH] handle RTL layouts BUG:187107 svn path=/trunk/KDE/kdelibs/; revision=1057270 --- extenders/extenderitem.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/extenders/extenderitem.cpp b/extenders/extenderitem.cpp index b075b6066..9d02a3728 100644 --- a/extenders/extenderitem.cpp +++ b/extenders/extenderitem.cpp @@ -497,7 +497,12 @@ void ExtenderItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti font.setWeight(QFont::Bold); //create a pixmap with the title that is faded out at the right side of the titleRect. - QRectF rect = QRectF(d->titleRect().width() - 30, 0, 30, d->titleRect().height()); + QRectF rect; + if (option->direction == Qt::LeftToRight) { + rect = QRectF(d->titleRect().width() - 30, 0, 30, d->titleRect().height()); + } else { + rect = QRectF(0, 0, 30, d->titleRect().height()); + } QPixmap pixmap(d->titleRect().size().toSize()); pixmap.fill(Qt::transparent); @@ -513,8 +518,13 @@ void ExtenderItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti QLinearGradient alphaGradient(0, 0, 1, 0); alphaGradient.setCoordinateMode(QGradient::ObjectBoundingMode); //TODO: correct handling of right to left text. - alphaGradient.setColorAt(0, QColor(0, 0, 0, 255)); - alphaGradient.setColorAt(1, QColor(0, 0, 0, 0)); + if (option->direction == Qt::LeftToRight) { + alphaGradient.setColorAt(0, QColor(0, 0, 0, 255)); + alphaGradient.setColorAt(1, QColor(0, 0, 0, 0)); + } else { + alphaGradient.setColorAt(1, QColor(0, 0, 0, 255)); + alphaGradient.setColorAt(0, QColor(0, 0, 0, 0)); + } p.setCompositionMode(QPainter::CompositionMode_DestinationIn); p.fillRect(rect, alphaGradient);