summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h
diff options
context:
space:
mode:
authorJoona Petrell <joona.t.petrell@nokia.com>2011-02-24 02:33:11 (GMT)
committerJoona Petrell <joona.t.petrell@nokia.com>2011-03-01 07:17:41 (GMT)
commit2c7cab4172f1acc86fd49345a2847417e162f2c3 (patch)
tree2df2e2bfccd17ed94980db0221ed3aec83afccb2 /src/declarative/graphicsitems/qdeclarativepositioners_p_p.h
parenta4b37abd96860a5bc46f88205bb11706cbaec228 (diff)
downloadQt-2c7cab4172f1acc86fd49345a2847417e162f2c3.zip
Qt-2c7cab4172f1acc86fd49345a2847417e162f2c3.tar.gz
Qt-2c7cab4172f1acc86fd49345a2847417e162f2c3.tar.bz2
Add LayoutMirroring attached property for mirroring QML layouts
Task-number: QTBUG-17280 Reviewed-by: Martin Jones Change-Id: I34a623b49ce0fd5c05ae7a7ea5d0437c107b8a9b
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativepositioners_p_p.h')
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners_p_p.h30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h
index df105c6..e80129d 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepositioners_p_p.h
@@ -75,7 +75,7 @@ public:
QDeclarativeBasePositionerPrivate()
: spacing(0), type(QDeclarativeBasePositioner::None)
, moveTransition(0), addTransition(0), queuedPositioning(false)
- , doingPositioning(false), anchorConflict(false)
+ , doingPositioning(false), anchorConflict(false), layoutDirection(Qt::LeftToRight)
{
}
@@ -100,6 +100,9 @@ public:
bool doingPositioning : 1;
bool anchorConflict : 1;
+ Qt::LayoutDirection layoutDirection;
+
+
void schedulePositioning()
{
Q_Q(QDeclarativeBasePositioner);
@@ -109,6 +112,18 @@ public:
}
}
+ void mirrorChange() {
+ Q_Q(QDeclarativeBasePositioner);
+ if (type != QDeclarativeBasePositioner::Vertical)
+ q->prePositioning();
+ }
+ bool isLeftToRight() const {
+ if (type == QDeclarativeBasePositioner::Vertical)
+ return true;
+ else
+ return effectiveLayoutMirror ? layoutDirection == Qt::RightToLeft : layoutDirection == Qt::LeftToRight;
+ }
+
virtual void itemSiblingOrderChanged(QDeclarativeItem* other)
{
Q_UNUSED(other);
@@ -139,6 +154,19 @@ public:
Q_Q(QDeclarativeBasePositioner);
q->positionedItems.removeOne(QDeclarativeBasePositioner::PositionedItem(item));
}
+
+ static Qt::LayoutDirection getLayoutDirection(const QDeclarativeBasePositioner *positioner)
+ {
+ return positioner->d_func()->layoutDirection;
+ }
+
+ static Qt::LayoutDirection getEffectiveLayoutDirection(const QDeclarativeBasePositioner *positioner)
+ {
+ if (positioner->d_func()->effectiveLayoutMirror)
+ return positioner->d_func()->layoutDirection == Qt::RightToLeft ? Qt::LeftToRight : Qt::RightToLeft;
+ else
+ return positioner->d_func()->layoutDirection;
+ }
};
QT_END_NAMESPACE