added the method

void invertLayout(bool invert);
inverts the layout of the icons if the orientation is horizontal,
normally we get icon on the left with left-to-right languages,
this inverts the behaviour

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=755564
This commit is contained in:
Marco Martin 2008-01-01 21:00:37 +00:00
parent 1ca970c48e
commit b6030dd8b3

View File

@ -131,6 +131,8 @@ public:
inline void setLayoutOptions(QTextLayout &layout, const QStyleOptionGraphicsItem *options) const;
inline Qt::LayoutDirection iconDirection(const QStyleOptionGraphicsItem *option) const;
// Margin functions
inline void setActiveMargins();
@ -181,6 +183,7 @@ public:
IconStates states;
Qt::Orientation orientation;
int numDisplayLines;
bool invertLayout;
QSizeF currentSize;
QList<IconAction*> cornerActions;
@ -206,6 +209,23 @@ void Icon::Private::setLayoutOptions(QTextLayout &layout, const QStyleOptionGrap
layout.setTextOption(textoption);
}
Qt::LayoutDirection Icon::Private::iconDirection(const QStyleOptionGraphicsItem *option) const
{
Qt::LayoutDirection direction;
if (invertLayout && orientation == Qt::Horizontal) {
if (option->direction == Qt::LeftToRight) {
direction = Qt::RightToLeft;
}else{
direction = Qt::LeftToRight;
}
}else{
direction = option->direction;
}
return direction;
}
void Icon::Private::setActiveMargins()
{
activeMargins = (orientation == Qt::Horizontal ?