diff options
author | Joona Petrell <joona.t.petrell@nokia.com> | 2011-04-14 07:36:38 (GMT) |
---|---|---|
committer | Joona Petrell <joona.t.petrell@nokia.com> | 2011-05-27 07:16:35 (GMT) |
commit | fbe0d24bdd429248dbf9e9be592f15fd7b1648bc (patch) | |
tree | 2f47219f2c1122c7c0b18f1be337be21ab752610 /examples | |
parent | 67ed18497705fa938728c505d165173dc5d3de68 (diff) | |
download | Qt-fbe0d24bdd429248dbf9e9be592f15fd7b1648bc.zip Qt-fbe0d24bdd429248dbf9e9be592f15fd7b1648bc.tar.gz Qt-fbe0d24bdd429248dbf9e9be592f15fd7b1648bc.tar.bz2 |
Remove unnecessary QtQuick 1.1 effectiveLayoutDirection, effectiveHorizontalAlignment and anchors.mirror properties
* these properties are seldomly used
* they confuse developers that do not care about right-to-left user interfaces
* LayoutMirroring.enabled property can be used instead to determine if mirroring is enabled
* if needed, you can easily determine the effective layout directions and alignments
with a little bit of JavaScript:
function effectiveLayoutDirection() {
if (LayoutMirroring.enabled)
return (listView.layoutDirection == Qt.LeftToRight) ? Qt.RightToLeft : Qt.LeftToRight;
else
return listView.layoutDirection;
}
Task-number: QTBUG-11042
Reviewed-by: Martin Jones
Diffstat (limited to 'examples')
-rw-r--r-- | examples/declarative/righttoleft/layoutdirection/layoutdirection.qml | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml b/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml index b4efebe..197ea39 100644 --- a/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml +++ b/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml @@ -226,7 +226,17 @@ Rectangle { Component { id: viewDelegate Item { - width: (listView.effectiveLayoutDirection == Qt.LeftToRight ? (index == 48 - 1) : (index == 0)) ? 40 : 50 + function effectiveLayoutDirection() { + if (LayoutMirroring.enabled) + if (listView.layoutDirection == Qt.LeftToRight) + return Qt.RightToLeft; + else + return Qt.LeftToRight; + else + return listView.layoutDirection; + } + + width: (effectiveLayoutDirection() == Qt.LeftToRight ? (index == 48 - 1) : (index == 0)) ? 40 : 50 Rectangle { width: 40; height: 40 color: Qt.rgba(0.5+(48 - index)*Math.random()/48, |