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:
parent
1ca970c48e
commit
b6030dd8b3
@ -131,6 +131,8 @@ public:
|
|||||||
|
|
||||||
inline void setLayoutOptions(QTextLayout &layout, const QStyleOptionGraphicsItem *options) const;
|
inline void setLayoutOptions(QTextLayout &layout, const QStyleOptionGraphicsItem *options) const;
|
||||||
|
|
||||||
|
inline Qt::LayoutDirection iconDirection(const QStyleOptionGraphicsItem *option) const;
|
||||||
|
|
||||||
|
|
||||||
// Margin functions
|
// Margin functions
|
||||||
inline void setActiveMargins();
|
inline void setActiveMargins();
|
||||||
@ -181,6 +183,7 @@ public:
|
|||||||
IconStates states;
|
IconStates states;
|
||||||
Qt::Orientation orientation;
|
Qt::Orientation orientation;
|
||||||
int numDisplayLines;
|
int numDisplayLines;
|
||||||
|
bool invertLayout;
|
||||||
QSizeF currentSize;
|
QSizeF currentSize;
|
||||||
|
|
||||||
QList<IconAction*> cornerActions;
|
QList<IconAction*> cornerActions;
|
||||||
@ -206,6 +209,23 @@ void Icon::Private::setLayoutOptions(QTextLayout &layout, const QStyleOptionGrap
|
|||||||
layout.setTextOption(textoption);
|
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()
|
void Icon::Private::setActiveMargins()
|
||||||
{
|
{
|
||||||
activeMargins = (orientation == Qt::Horizontal ?
|
activeMargins = (orientation == Qt::Horizontal ?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user