diff options
author | Jan Arve Sæther <jan-arve.saether@qt.io> | 2019-10-22 13:33:59 +0200 |
---|---|---|
committer | Jan Arve Sæther <jan-arve.saether@qt.io> | 2019-10-25 14:37:21 +0000 |
commit | 032c356ec91879599d6770bfb061a85b0f10eb34 (patch) | |
tree | 343205b2df7ea4c5b14e9bc56c027c5cb8c7cc08 | |
parent | b6d88c73c4affec93655f97588abc7ae1d53cea0 (diff) |
Add missing emits from various property setters in {Grid,Row}Layout
Change-Id: I3ac473b3d46ff1f898c1607deb6ad3d586753244
Fixes: QTBUG-79359
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r-- | src/imports/layouts/qquicklinearlayout.cpp | 6 | ||||
-rw-r--r-- | tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml | 54 |
2 files changed, 60 insertions, 0 deletions
diff --git a/src/imports/layouts/qquicklinearlayout.cpp b/src/imports/layouts/qquicklinearlayout.cpp index fa51ef1f2f..2e3b12064b 100644 --- a/src/imports/layouts/qquicklinearlayout.cpp +++ b/src/imports/layouts/qquicklinearlayout.cpp @@ -283,8 +283,11 @@ Qt::LayoutDirection QQuickGridLayoutBase::layoutDirection() const void QQuickGridLayoutBase::setLayoutDirection(Qt::LayoutDirection dir) { Q_D(QQuickGridLayoutBase); + if (d->m_layoutDirection == dir) + return; d->m_layoutDirection = dir; invalidate(); + emit layoutDirectionChanged(); } Qt::LayoutDirection QQuickGridLayoutBase::effectiveLayoutDirection() const @@ -524,6 +527,7 @@ void QQuickGridLayout::setColumnSpacing(qreal spacing) d->engine.setSpacing(spacing, Qt::Horizontal); invalidate(); + emit columnSpacingChanged(); } /*! @@ -546,6 +550,7 @@ void QQuickGridLayout::setRowSpacing(qreal spacing) d->engine.setSpacing(spacing, Qt::Vertical); invalidate(); + emit rowSpacingChanged(); } /*! @@ -817,6 +822,7 @@ void QQuickLinearLayout::setSpacing(qreal space) d->engine.setSpacing(space, Qt::Horizontal | Qt::Vertical); invalidate(); + emit spacingChanged(); } void QQuickLinearLayout::insertLayoutItems() diff --git a/tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml b/tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml index 49838c4fd5..e8b3960486 100644 --- a/tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml +++ b/tests/auto/quick/qquicklayouts/data/tst_gridlayout.qml @@ -1019,5 +1019,59 @@ Item { waitForRendering(layout); verify(layout.children[1].visible == false); } + + + + Component { + id: gridlayout_propertyChanges_Component + GridLayout { + columns: 1 + property alias spy : signalSpy + SignalSpy { + id: signalSpy + target: parent + } + } + } + + Component { + id: rowlayout_propertyChanges_Component + RowLayout { + property alias spy : signalSpy + SignalSpy { + id: signalSpy + target: parent + } + } + } + + function test_propertyChanges_data() + { + let data = [ + { tag: "columnSpacing", value: 9 }, + { tag: "rowSpacing", value: 9 }, + { tag: "columns", value: 2 }, + { tag: "rows", value: 2 }, + { tag: "flow", value: GridLayout.TopToBottom}, + { tag: "layoutDirection", value: Qt.RightToLeft }, + { tag: "spacing", value: 9 } + ] + return data + } + + function test_propertyChanges(data) + { + var propName = data.tag + var layout = createTemporaryObject(propName === "spacing" + ? rowlayout_propertyChanges_Component + : gridlayout_propertyChanges_Component + , container) + + layout.spy.signalName = propName + "Changed" + verify(layout.spy.valid) + + layout[propName] = data.value + compare(layout.spy.count, 1) + } } } |