From fbe0d24bdd429248dbf9e9be592f15fd7b1648bc Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Thu, 14 Apr 2011 10:36:38 +0300 Subject: 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 --- doc/src/declarative/righttoleft.qdoc | 17 +++---- doc/src/declarative/whatsnew.qdoc | 14 +---- .../layoutdirection/layoutdirection.qml | 12 ++++- .../graphicsitems/qdeclarativeanchors_p.h | 2 - .../graphicsitems/qdeclarativegridview.cpp | 22 +++----- .../graphicsitems/qdeclarativegridview_p.h | 2 - src/declarative/graphicsitems/qdeclarativeitem.cpp | 1 - .../graphicsitems/qdeclarativelistview.cpp | 20 +++----- .../graphicsitems/qdeclarativelistview_p.h | 2 - .../graphicsitems/qdeclarativepositioners.cpp | 59 +++++++--------------- .../graphicsitems/qdeclarativepositioners_p.h | 6 --- src/declarative/graphicsitems/qdeclarativetext.cpp | 9 +--- src/declarative/graphicsitems/qdeclarativetext_p.h | 2 - .../graphicsitems/qdeclarativetextedit.cpp | 8 +-- .../graphicsitems/qdeclarativetextedit_p.h | 2 - .../graphicsitems/qdeclarativetextinput.cpp | 9 ++-- .../graphicsitems/qdeclarativetextinput_p.h | 2 - .../tst_qdeclarativeanchors.cpp | 5 +- 18 files changed, 58 insertions(+), 136 deletions(-) diff --git a/doc/src/declarative/righttoleft.qdoc b/doc/src/declarative/righttoleft.qdoc index 7db6136..cafc702 100644 --- a/doc/src/declarative/righttoleft.qdoc +++ b/doc/src/declarative/righttoleft.qdoc @@ -64,8 +64,7 @@ This default locale-based alignment can be overriden by setting the \c horizonta property for the text element, or by enabling layout mirroring using the \l LayoutMirroring attached property, which causes any explicit left and right horizontal alignments to be mirrored. Note that when \l LayoutMirroring is set, the \c horizontalAlignment property value remains unchanged; -the effective alignment of the text element that takes the mirroring into account can be read from the -\c effectiveHorizontalAlignment property. +use the property \c LayoutMirroring.enabled instead to query whether the mirroring is in effect. \snippet doc/src/snippets/declarative/righttoleft.qml 0 @@ -79,9 +78,9 @@ property for controlling the horizontal direction of the layouts. Setting \c lay the left-to-right layout direction. The horizontal layout direction can also be reversed through the \l LayoutMirroring attached property. -This causes the effective \c layoutDirection of positioners and views to be mirrored. Note the actual value -of the \c layoutDirection property will remain unchanged; the effective layout direction of positioners and -views that takes the mirroring into account can be read from the \c effectiveLayoutDirection property. +This causes the effective \c layoutDirection of positioners and views to be mirrored. Note though that the actual +value of the \c layoutDirection property will remain unchanged; use the property \c LayoutMirroring.enabled instead +to query whether the mirroring is in effect. \snippet doc/src/snippets/declarative/righttoleft.qml 1 @@ -101,12 +100,8 @@ Or set all child elements to also inherit the layout direction: \snippet doc/src/snippets/declarative/righttoleft.qml 3 Applying mirroring in this manner does not change the actual value of the relevant anchor, -\c layoutDirection or \c horizontalAlignment properties. The separate read-only property -\c effectiveLayoutDirection can be used to query the effective layout -direction of positioners and model views that takes the mirroring into account. Similarly the \l Text, -\l TextInput and \l TextEdit elements have gained the read-only property \c effectiveHorizontalAlignment -for querying the effective visual alignment of text. For anchors, the read only -\l {Item::anchors}{anchors.mirrored} property reflects whether anchors have been mirrored. +\c layoutDirection or \c horizontalAlignment properties. You can use \c LayoutMirroring.enabled to +query whether the mirroring is in effect. Note that application layouts and animations that are defined using \l {Item::}{x} property values (as opposed to anchors or positioner elements) are not affected by the \l LayoutMirroring attached property. diff --git a/doc/src/declarative/whatsnew.qdoc b/doc/src/declarative/whatsnew.qdoc index 6eb1548..c36a88c 100644 --- a/doc/src/declarative/whatsnew.qdoc +++ b/doc/src/declarative/whatsnew.qdoc @@ -41,13 +41,6 @@ PinchArea provides support for the common two finger pinch gesture. \l {LayoutMirroring}{Layout mirroring} is useful when you need to support both left-to-right and right-to-left layout versions of your application that target different language areas. -\section2 Anchors - -Added the following property: -\list -\o \l {Item::}{anchors.mirrored} -\endlist - \section2 Text Added the following properties: @@ -57,7 +50,6 @@ Added the following properties: \o \l {Text::}{lineCount} \o \l {Text::}{maximumLineCount} \o \l {Text::}{truncated} -\o \l {Text::}{effectiveHorizontalAlignment} \endlist horizontalAlignment now accepts Text.AlignJustify alignment mode. @@ -70,7 +62,6 @@ Added the following properties, methods and signal handlers: \o \l {TextEdit::}{lineCount} \o \l {TextEdit::}{inputMethodComposing} \o \l {TextEdit::}{mouseSelectionMode} -\o \l {TextEdit::}{effectiveHorizontalAlignment} \o \l {TextEdit::}{deselect()} \o \l {TextEdit::}{isRightToLeft()} \o \l {TextEdit::}{moveCursorSelection()} to enable selection by word @@ -84,7 +75,6 @@ Added the following properties and methods: \o \l {TextInput::}{canPaste} \o \l {TextInput::}{inputMethodComposing} \o \l {TextInput::}{mouseSelectionMode} -\o \l {TextInput::}{effectiveHorizontalAlignment} \o \l {TextInput::}{deselect()} \o \l {TextInput::}{isRightToLeft()} \o \l {TextInput::}{moveCursorSelection()} to enable selection by word @@ -125,17 +115,15 @@ Added the following property: Added the following properties and methods: \list \o \l{ListView::}{layoutDirection} -\o \l{ListView::}{effectiveLayoutDirection} \o \l{ListView::}{positionViewAtBeginning()} \o \l{ListView::}{positionViewAtEnd()} \endlist \section2 Flow, Grid and Row -Added the following properties: +Added the following property: \list \o \l{Flow::}{layoutDirection} -\o \l{Flow::}{effectiveLayoutDirection} \endlist \section2 Repeater 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, diff --git a/src/declarative/graphicsitems/qdeclarativeanchors_p.h b/src/declarative/graphicsitems/qdeclarativeanchors_p.h index 388d6b9..f07ac23 100644 --- a/src/declarative/graphicsitems/qdeclarativeanchors_p.h +++ b/src/declarative/graphicsitems/qdeclarativeanchors_p.h @@ -79,7 +79,6 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeAnchors : public QObject Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged) Q_PROPERTY(QGraphicsObject *fill READ fill WRITE setFill RESET resetFill NOTIFY fillChanged) Q_PROPERTY(QGraphicsObject *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn NOTIFY centerInChanged) - Q_PROPERTY(bool mirrored READ mirrored NOTIFY mirroredChanged REVISION 1) public: QDeclarativeAnchors(QObject *parent=0); @@ -184,7 +183,6 @@ Q_SIGNALS: void verticalCenterOffsetChanged(); void horizontalCenterOffsetChanged(); void baselineOffsetChanged(); - Q_REVISION(1) void mirroredChanged(); private: friend class QDeclarativeItem; diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 460f2c3..184569e 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -206,7 +206,6 @@ public: void mirrorChange() { Q_Q(QDeclarativeGridView); regenerate(); - emit q->effectiveLayoutDirectionChanged(); } qreal position() const { @@ -1802,9 +1801,12 @@ void QDeclarativeGridView::setHighlightRangeMode(HighlightRangeMode mode) on the \l GridView:flow property. \endlist - \bold Note: If GridView::flow is set to GridView.LeftToRight, this is not to be confused if - GridView::layoutDirection is set to Qt.RightToLeft. The GridView.LeftToRight flow value simply - indicates that the flow is horizontal. + When using the attached property \l {LayoutMirroring::enabled} for locale layouts, + the layout direction of the grid view will be mirrored. However, the actual property + \c layoutDirection will remain unchanged. You can use the property + \l {LayoutMirroring::enabled} to determine whether the direction has been mirrored. + + \sa {LayoutMirroring}{LayoutMirroring} */ Qt::LayoutDirection QDeclarativeGridView::layoutDirection() const @@ -1820,21 +1822,9 @@ void QDeclarativeGridView::setLayoutDirection(Qt::LayoutDirection layoutDirectio d->layoutDirection = layoutDirection; d->regenerate(); emit layoutDirectionChanged(); - emit effectiveLayoutDirectionChanged(); } } -/*! - \qmlproperty enumeration GridView::effectiveLayoutDirection - This property holds the effective layout direction of the grid. - - When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts, - the visual layout direction of the grid will be mirrored. However, the - property \l {GridView::layoutDirection}{layoutDirection} will remain unchanged. - - \sa GridView::layoutDirection, {LayoutMirroring}{LayoutMirroring} -*/ - Qt::LayoutDirection QDeclarativeGridView::effectiveLayoutDirection() const { Q_D(const QDeclarativeGridView); diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h index 4d99a14..628e98e 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview_p.h +++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h @@ -75,7 +75,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeGridView : public QDeclarativeFlickable Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) - Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1) Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled NOTIFY keyNavigationWrapsChanged) Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged) Q_PROPERTY(int cellWidth READ cellWidth WRITE setCellWidth NOTIFY cellWidthChanged) @@ -194,7 +193,6 @@ Q_SIGNALS: void delegateChanged(); void flowChanged(); Q_REVISION(1) void layoutDirectionChanged(); - Q_REVISION(1) void effectiveLayoutDirectionChanged(); void keyNavigationWrapsChanged(); void cacheBufferChanged(); void snapModeChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 6602dda..93d3222 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -898,7 +898,6 @@ void QDeclarativeItemPrivate::setLayoutMirror(bool mirror) _anchors->d_func()->fillChanged(); _anchors->d_func()->centerInChanged(); _anchors->d_func()->updateHorizontalAnchors(); - emit _anchors->mirroredChanged(); } mirrorChange(); if (attachedLayoutDirection) { diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 79d67e7..734c732 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -298,7 +298,6 @@ public: void mirrorChange() { Q_Q(QDeclarativeListView); regenerate(); - emit q->effectiveLayoutDirectionChanged(); } bool isRightToLeft() const { @@ -2169,7 +2168,12 @@ void QDeclarativeListView::setOrientation(QDeclarativeListView::Orientation orie \o Qt.RightToLeft - Items will be laid out from right to let. \endlist - \sa ListView::effectiveLayoutDirection + When using the attached property \l {LayoutMirroring::enabled} for locale layouts, + the layout direction of the horizontal list will be mirrored. However, the actual property + \c layoutDirection will remain unchanged. You can use the property + \l {LayoutMirroring::enabled} to determine whether the direction has been mirrored. + + \sa {LayoutMirroring}{LayoutMirroring} */ Qt::LayoutDirection QDeclarativeListView::layoutDirection() const @@ -2185,21 +2189,9 @@ void QDeclarativeListView::setLayoutDirection(Qt::LayoutDirection layoutDirectio d->layoutDirection = layoutDirection; d->regenerate(); emit layoutDirectionChanged(); - emit effectiveLayoutDirectionChanged(); } } -/*! - \qmlproperty enumeration ListView::effectiveLayoutDirection - This property holds the effective layout direction of the horizontal list. - - When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts, - the visual layout direction of the horizontal list will be mirrored. However, the - property \l {ListView::layoutDirection}{layoutDirection} will remain unchanged. - - \sa ListView::layoutDirection, {LayoutMirroring}{LayoutMirroring} -*/ - Qt::LayoutDirection QDeclarativeListView::effectiveLayoutDirection() const { Q_D(const QDeclarativeListView); diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h index 3b12225..70ca9de 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview_p.h +++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h @@ -114,7 +114,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeListView : public QDeclarativeFlickable Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing NOTIFY spacingChanged) Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) - Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1) Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled NOTIFY keyNavigationWrapsChanged) Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged) Q_PROPERTY(QDeclarativeViewSection *section READ sectionCriteria CONSTANT) @@ -229,7 +228,6 @@ Q_SIGNALS: void spacingChanged(); void orientationChanged(); Q_REVISION(1) void layoutDirectionChanged(); - Q_REVISION(1) void effectiveLayoutDirectionChanged(); void currentIndexChanged(); void currentSectionChanged(); void highlightMoveSpeedChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index e76fc03..55ec961 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -597,7 +597,12 @@ QDeclarativeRow::QDeclarativeRow(QDeclarativeItem *parent) the right anchor remains to the right of the row. \endlist - \sa Grid::layoutDirection, Flow::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example} + When using the attached property \l {LayoutMirroring::enabled} for locale layouts, + the visual layout direction of the row positioner will be mirrored. However, the + property \c layoutDirection will remain unchanged. You can use the property + \l {LayoutMirroring::enabled} to determine whether the direction has been mirrored. + + \sa Grid::layoutDirection, Flow::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example}, {LayoutMirroring}{LayoutMirroring} */ Qt::LayoutDirection QDeclarativeRow::layoutDirection() const { @@ -616,21 +621,9 @@ void QDeclarativeRow::setLayoutDirection(Qt::LayoutDirection layoutDirection) d->removeItemChangeListener(d, QDeclarativeItemPrivate::Geometry); prePositioning(); emit layoutDirectionChanged(); - emit effectiveLayoutDirectionChanged(); } } -/*! - \qmlproperty enumeration Row::effectiveLayoutDirection - This property holds the effective layout direction of the row positioner. - - When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts, - the visual layout direction of the row positioner will be mirrored. However, the - property \l {Row::layoutDirection}{layoutDirection} will remain unchanged. - - \sa Row::layoutDirection, {LayoutMirroring}{LayoutMirroring} -*/ - Qt::LayoutDirection QDeclarativeRow::effectiveLayoutDirection() const { return QDeclarativeBasePositionerPrivate::getEffectiveLayoutDirection(this); @@ -900,7 +893,12 @@ void QDeclarativeGrid::setFlow(Flow flow) \l Grid::flow property. \endlist - \sa Flow::layoutDirection, Row::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example} + When using the attached property \l {LayoutMirroring::enabled} for locale layouts, + the visual layout direction of the grid positioner will be mirrored. However, the + property \c layoutDirection will remain unchanged. You can use the property + \l {LayoutMirroring::enabled} to determine whether the direction has been mirrored. + + \sa Flow::layoutDirection, Row::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example}, {LayoutMirroring}{LayoutMirroring} */ Qt::LayoutDirection QDeclarativeGrid::layoutDirection() const { @@ -918,22 +916,10 @@ void QDeclarativeGrid::setLayoutDirection(Qt::LayoutDirection layoutDirection) else d->removeItemChangeListener(d, QDeclarativeItemPrivate::Geometry); prePositioning(); - emit layoutDirectionChanged(); - emit effectiveLayoutDirectionChanged(); + emit layoutDirectionChanged();; } } -/*! - \qmlproperty enumeration Grid::effectiveLayoutDirection - This property holds the effective layout direction of the grid positioner. - - When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts, - the visual layout direction of the grid positioner will be mirrored. However, the - property \l {Grid::layoutDirection}{layoutDirection} will remain unchanged. - - \sa Grid::layoutDirection, {LayoutMirroring}{LayoutMirroring} -*/ - Qt::LayoutDirection QDeclarativeGrid::effectiveLayoutDirection() const { return QDeclarativeBasePositionerPrivate::getEffectiveLayoutDirection(this); @@ -1265,7 +1251,12 @@ void QDeclarativeFlow::setFlow(Flow flow) \l Flow::flow property. \endlist - \sa Grid::layoutDirection, Row::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example} + When using the attached property \l {LayoutMirroring::enabled} for locale layouts, + the visual layout direction of the flow positioner will be mirrored. However, the + property \c layoutDirection will remain unchanged. You can use the property + \l {LayoutMirroring::enabled} to determine whether the direction has been mirrored. + + \sa Grid::layoutDirection, Row::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example}, {LayoutMirroring}{LayoutMirroring} */ Qt::LayoutDirection QDeclarativeFlow::layoutDirection() const @@ -1281,21 +1272,9 @@ void QDeclarativeFlow::setLayoutDirection(Qt::LayoutDirection layoutDirection) d->layoutDirection = layoutDirection; prePositioning(); emit layoutDirectionChanged(); - emit effectiveLayoutDirectionChanged(); } } -/*! - \qmlproperty enumeration Flow::effectiveLayoutDirection - This property holds the effective layout direction of the flow positioner. - - When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts, - the visual layout direction of the grid positioner will be mirrored. However, the - property \l {Flow::layoutDirection}{layoutDirection} will remain unchanged. - - \sa Flow::layoutDirection, {LayoutMirroring}{LayoutMirroring} -*/ - Qt::LayoutDirection QDeclarativeFlow::effectiveLayoutDirection() const { return QDeclarativeBasePositionerPrivate::getEffectiveLayoutDirection(this); diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h index 214c04f..5c6c3c8 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h +++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h @@ -130,7 +130,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeRow: public QDeclarativeBasePositioner { Q_OBJECT Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) - Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1) public: QDeclarativeRow(QDeclarativeItem *parent=0); @@ -140,7 +139,6 @@ public: Q_SIGNALS: Q_REVISION(1) void layoutDirectionChanged(); - Q_REVISION(1) void effectiveLayoutDirectionChanged(); protected: virtual void doPositioning(QSizeF *contentSize); @@ -156,7 +154,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeGrid : public QDeclarativeBasePositioner Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged) Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) - Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1) public: QDeclarativeGrid(QDeclarativeItem *parent=0); @@ -180,7 +177,6 @@ Q_SIGNALS: void columnsChanged(); void flowChanged(); Q_REVISION(1) void layoutDirectionChanged(); - Q_REVISION(1) void effectiveLayoutDirectionChanged(); protected: virtual void doPositioning(QSizeF *contentSize); @@ -199,7 +195,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeFlow: public QDeclarativeBasePositioner Q_OBJECT Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) - Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1) public: QDeclarativeFlow(QDeclarativeItem *parent=0); @@ -214,7 +209,6 @@ public: Q_SIGNALS: void flowChanged(); Q_REVISION(1) void layoutDirectionChanged(); - Q_REVISION(1) void effectiveLayoutDirectionChanged(); protected: virtual void doPositioning(QSizeF *contentSize); diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 1d51840..c2947be 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -1063,7 +1063,6 @@ void QDeclarativeText::setStyleColor(const QColor &color) /*! \qmlproperty enumeration Text::horizontalAlignment \qmlproperty enumeration Text::verticalAlignment - \qmlproperty enumeration Text::effectiveHorizontalAlignment Sets the horizontal and vertical alignment of the text within the Text items width and height. By default, the text is vertically aligned to the top. Horizontal @@ -1079,10 +1078,10 @@ void QDeclarativeText::setStyleColor(const QColor &color) need to either modify the Item::anchors, or set horizontalAlignment to Text.AlignHCenter and bind the width to that of the parent. - When using the attached property LayoutMirroring::enabled to mirror application + When using the attached property \l {LayoutMirroring::enabled} to mirror application layouts, the horizontal alignment of text will also be mirrored. However, the property \c horizontalAlignment will remain unchanged. To query the effective horizontal alignment - of Text, use the read-only property \c effectiveHorizontalAlignment. + of Text, use the property \l {LayoutMirroring::enabled}. */ QDeclarativeText::HAlignment QDeclarativeText::hAlign() const { @@ -1132,10 +1131,7 @@ bool QDeclarativeTextPrivate::setHAlign(QDeclarativeText::HAlignment alignment, if (hAlign != alignment || forceAlign) { QDeclarativeText::HAlignment oldEffectiveHAlign = q->effectiveHAlign(); hAlign = alignment; - emit q->horizontalAlignmentChanged(hAlign); - if (oldEffectiveHAlign != q->effectiveHAlign()) - emit q->effectiveHorizontalAlignmentChanged(); return true; } return false; @@ -1157,7 +1153,6 @@ void QDeclarativeTextPrivate::mirrorChange() if (q->isComponentComplete()) { if (!hAlignImplicit && (hAlign == QDeclarativeText::AlignRight || hAlign == QDeclarativeText::AlignLeft)) { updateLayout(); - emit q->effectiveHorizontalAlignmentChanged(); } } } diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h index a1153c2..d1f5906 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p.h @@ -70,7 +70,6 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeText : public QDeclarativeImplici Q_PROPERTY(TextStyle style READ style WRITE setStyle NOTIFY styleChanged) Q_PROPERTY(QColor styleColor READ styleColor WRITE setStyleColor NOTIFY styleColorChanged) Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign RESET resetHAlign NOTIFY horizontalAlignmentChanged) - Q_PROPERTY(HAlignment effectiveHorizontalAlignment READ effectiveHAlign NOTIFY effectiveHorizontalAlignmentChanged REVISION 1) Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged) Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged REVISION 1) @@ -191,7 +190,6 @@ Q_SIGNALS: void paintedSizeChanged(); Q_REVISION(1) void lineHeightChanged(qreal lineHeight); Q_REVISION(1) void lineHeightModeChanged(LineHeightMode mode); - Q_REVISION(1) void effectiveHorizontalAlignmentChanged(); protected: void mousePressEvent(QGraphicsSceneMouseEvent *event); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index af2c8f3..93fa8a5 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -459,7 +459,6 @@ void QDeclarativeTextEdit::setSelectedTextColor(const QColor &color) /*! \qmlproperty enumeration TextEdit::horizontalAlignment \qmlproperty enumeration TextEdit::verticalAlignment - \qmlproperty enumeration TextEdit::effectiveHorizontalAlignment Sets the horizontal and vertical alignment of the text within the TextEdit item's width and height. By default, the text alignment follows the natural alignment @@ -481,10 +480,10 @@ void QDeclarativeTextEdit::setSelectedTextColor(const QColor &color) \o TextEdit.AlignVCenter \endlist - When using the attached property LayoutMirroring::enabled to mirror application + When using the attached property \l {LayoutMirroring::enabled} to mirror application layouts, the horizontal alignment of text will also be mirrored. However, the property \c horizontalAlignment will remain unchanged. To query the effective horizontal alignment - of TextEdit, use the read-only property \c effectiveHorizontalAlignment. + of TextEdit, use the property \l {LayoutMirroring::enabled}. */ QDeclarativeTextEdit::HAlignment QDeclarativeTextEdit::hAlign() const { @@ -539,8 +538,6 @@ bool QDeclarativeTextEditPrivate::setHAlign(QDeclarativeTextEdit::HAlignment ali QDeclarativeTextEdit::HAlignment oldEffectiveHAlign = q->effectiveHAlign(); hAlign = alignment; emit q->horizontalAlignmentChanged(alignment); - if (oldEffectiveHAlign != q->effectiveHAlign()) - emit q->effectiveHorizontalAlignmentChanged(); return true; } return false; @@ -563,7 +560,6 @@ void QDeclarativeTextEditPrivate::mirrorChange() if (!hAlignImplicit && (hAlign == QDeclarativeTextEdit::AlignRight || hAlign == QDeclarativeTextEdit::AlignLeft)) { updateDefaultTextOption(); q->updateSize(); - emit q->effectiveHorizontalAlignmentChanged(); } } } diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 25ca1e7..7a17bd8 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -73,7 +73,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativeImplicitSizePa Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor NOTIFY selectedTextColorChanged) Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign RESET resetHAlign NOTIFY horizontalAlignmentChanged) - Q_PROPERTY(HAlignment effectiveHorizontalAlignment READ effectiveHAlign NOTIFY effectiveHorizontalAlignmentChanged REVISION 1) Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged) Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged REVISION 1) @@ -249,7 +248,6 @@ Q_SIGNALS: Q_REVISION(1) void linkActivated(const QString &link); Q_REVISION(1) void canPasteChanged(); Q_REVISION(1) void inputMethodComposingChanged(); - Q_REVISION(1) void effectiveHorizontalAlignmentChanged(); public Q_SLOTS: void selectAll(); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 226cce9..0d10bb6 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -326,7 +326,6 @@ void QDeclarativeTextInput::setSelectedTextColor(const QColor &color) /*! \qmlproperty enumeration TextInput::horizontalAlignment - \qmlproperty enumeration TextInput::effectiveHorizontalAlignment Sets the horizontal alignment of the text within the TextInput item's width and height. By default, the text alignment follows the natural alignment @@ -342,10 +341,10 @@ void QDeclarativeTextInput::setSelectedTextColor(const QColor &color) The valid values for \c horizontalAlignment are \c TextInput.AlignLeft, \c TextInput.AlignRight and \c TextInput.AlignHCenter. - When using the attached property LayoutMirroring::enabled to mirror application + When using the attached property \l {LayoutMirroring::enabled} to mirror application layouts, the horizontal alignment of text will also be mirrored. However, the property \c horizontalAlignment will remain unchanged. To query the effective horizontal alignment - of TextInput, use the read-only property \c effectiveHorizontalAlignment. + of TextInput, use the property \l {LayoutMirroring::enabled}. */ QDeclarativeTextInput::HAlignment QDeclarativeTextInput::hAlign() const { @@ -398,8 +397,6 @@ bool QDeclarativeTextInputPrivate::setHAlign(QDeclarativeTextInput::HAlignment a QDeclarativeTextInput::HAlignment oldEffectiveHAlign = q->effectiveHAlign(); hAlign = alignment; emit q->horizontalAlignmentChanged(alignment); - if (oldEffectiveHAlign != q->effectiveHAlign()) - emit q->effectiveHorizontalAlignmentChanged(); return true; } return false; @@ -422,7 +419,7 @@ void QDeclarativeTextInputPrivate::mirrorChange() if (q->isComponentComplete()) { if (!hAlignImplicit && (hAlign == QDeclarativeTextInput::AlignRight || hAlign == QDeclarativeTextInput::AlignLeft)) { q->updateCursorRectangle(); - emit q->effectiveHorizontalAlignmentChanged(); + updateHorizontalScroll(); } } } diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index 171db92..04c6ff4 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -71,7 +71,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextInput : public QDeclarativeImplicitSizeP Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor NOTIFY selectedTextColorChanged) Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign RESET resetHAlign NOTIFY horizontalAlignmentChanged) - Q_PROPERTY(HAlignment effectiveHorizontalAlignment READ effectiveHAlign NOTIFY effectiveHorizontalAlignmentChanged REVISION 1) Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged) Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged) Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged) @@ -247,7 +246,6 @@ Q_SIGNALS: Q_REVISION(1) void mouseSelectionModeChanged(SelectionMode mode); Q_REVISION(1) void canPasteChanged(); Q_REVISION(1) void inputMethodComposingChanged(); - Q_REVISION(1) void effectiveHorizontalAlignmentChanged(); protected: virtual void geometryChanged(const QRectF &newGeometry, diff --git a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp index 0442350..3d8d2d9 100644 --- a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp +++ b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp @@ -58,7 +58,6 @@ Q_DECLARE_METATYPE(QDeclarativeAnchors::Anchor) Q_DECLARE_METATYPE(QDeclarativeAnchorLine::AnchorLine) - class tst_qdeclarativeanchors : public QObject { Q_OBJECT @@ -291,7 +290,7 @@ void tst_qdeclarativeanchors::basicAnchorsRTL() QDeclarativeItem* rootItem = qobject_cast(view->rootObject()); foreach(QObject *child, rootItem->children()) { - bool mirrored = QDeclarativeItemPrivate::get(qobject_cast(child))->anchors()->property("mirrored").toBool(); + bool mirrored = QDeclarativeItemPrivate::get(qobject_cast(child))->anchors()->mirrored(); QCOMPARE(mirrored, false); } @@ -299,7 +298,7 @@ void tst_qdeclarativeanchors::basicAnchorsRTL() mirrorAnchors(qobject_cast(child)); foreach(QObject *child, rootItem->children()) { - bool mirrored = QDeclarativeItemPrivate::get(qobject_cast(child))->anchors()->property("mirrored").toBool(); + bool mirrored = QDeclarativeItemPrivate::get(qobject_cast(child))->anchors()->mirrored(); QCOMPARE(mirrored, true); } -- cgit v0.12