show the panel toolbox on the left when plasma starts with an RTL layout

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=806621
This commit is contained in:
Marco Martin 2008-05-11 20:58:49 +00:00
parent 7c2bd78598
commit d03f49e72f
2 changed files with 12 additions and 1 deletions

View File

@ -913,7 +913,11 @@ void Containment::Private::containmentConstraintsEvent(Plasma::Constraints const
//defaulting to Horizontal right now
} else {
toolBox->setOrientation(Qt::Horizontal);
toolBox->setPos(q->geometry().width(), q->geometry().height()/2 - toolBox->boundingRect().height()/2);
if (QApplication::layoutDirection() == Qt::RightToLeft) {
toolBox->setPos(q->geometry().left(), q->geometry().height()/2 - toolBox->boundingRect().height()/2);
} else {
toolBox->setPos(q->geometry().width(), q->geometry().height()/2 - toolBox->boundingRect().height()/2);
}
}
} else {
toolBox->setPos(q->geometry().right() - qAbs(toolBox->boundingRect().width()), 0);

View File

@ -23,6 +23,7 @@
#include <QGraphicsSceneHoverEvent>
#include <QPainter>
#include <QRadialGradient>
#include <QApplication>
#include <plasma/theme.h>
#include <KColorScheme>
@ -114,6 +115,8 @@ QRectF PanelToolbox::boundingRect() const
if (orientation() == Qt::Vertical) {
return QRectF(0, 0, size()*2, -size());
//horizontal
} else if (QApplication::layoutDirection() == Qt::RightToLeft) {
return QRectF(0, 0, size(), size()*2);
} else {
return QRectF(0, 0, -size(), size()*2);
}
@ -163,6 +166,8 @@ void PanelToolbox::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
if (orientation() == Qt::Vertical) {
iconRect = QRect(QPoint(gradientCenter.x() - iconSize().width()/2, (int)boundingRect().top() - iconSize().height() - 2), iconSize());
} else if (QApplication::layoutDirection() == Qt::RightToLeft) {
iconRect = QRect(QPoint(2, gradientCenter.y() - iconSize().height()/2), iconSize());
} else {
iconRect = QRect(QPoint((int)boundingRect().left() - iconSize().width() + 2, gradientCenter.y() - iconSize().height()/2), iconSize());
}
@ -188,6 +193,8 @@ QPainterPath PanelToolbox::shape() const
if (orientation() == Qt::Vertical) {
path.arcTo(QRectF(boundingRect().center().x() - toolSize, boundingRect().top() - toolSize, toolSize*2, toolSize*2), 0, 180);
} else if (QApplication::layoutDirection() == Qt::RightToLeft) {
path.arcTo(QRectF(boundingRect().left() - toolSize, boundingRect().center().y() - toolSize, toolSize*2, toolSize*2), 90, -180);
} else {
path.arcTo(QRectF(boundingRect().left() - toolSize, boundingRect().center().y() - toolSize, toolSize*2, toolSize*2), 90, 180);
}