diff options
author | Michael Brasser <mbrasser@ford.com> | 2016-10-21 17:21:36 -0500 |
---|---|---|
committer | Michael Brasser <michael.brasser@live.com> | 2017-01-13 03:02:09 +0000 |
commit | 0820efecb48d241f46f13f72c688d809fab6b72d (patch) | |
tree | 30facfdace243aeeec7f89f774cd41ebb7703e2a /src/quick/items/qquickpositioners.cpp | |
parent | 93df3e3a3118080dcd6d9416d1622b88d99c4b8d (diff) |
Improve visibility into Positioner positioning from QML
Add a forceLayout function, similar to the views, as well
as a signal that indicates when positioning has completed.
Change-Id: Ice01ea0840c707e403fdd4ea59d92a89e2ed8e4b
Task-number: QTBUG-44762
Task-number: QTBUG-32114
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/quick/items/qquickpositioners.cpp')
-rw-r--r-- | src/quick/items/qquickpositioners.cpp | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp index 0287fdd45c..05d3ae0191 100644 --- a/src/quick/items/qquickpositioners.cpp +++ b/src/quick/items/qquickpositioners.cpp @@ -290,6 +290,11 @@ void QQuickBasePositioner::itemChange(ItemChange change, const ItemChangeData &v QQuickItem::itemChange(change, value); } +void QQuickBasePositioner::forceLayout() +{ + updatePolish(); +} + void QQuickBasePositioner::prePositioning() { Q_D(QQuickBasePositioner); @@ -401,6 +406,8 @@ void QQuickBasePositioner::prePositioning() //Set implicit size to the size of its children setImplicitSize(contentSize.width(), contentSize.height()); + + emit positioningComplete(); } void QQuickBasePositioner::positionItem(qreal x, qreal y, PositionedItem *target) @@ -910,6 +917,28 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem) \sa Grid::spacing */ +/*! + \qmlmethod QtQuick::Column::forceLayout() + \since 5.9 + + Column typically positions its children once per frame. This means that + inside script blocks it is possible for the underlying children to have changed, + but the Column to have not yet been updated accordingly. + + This method forces the Column to immediately respond to any outstanding + changes in its children. + + \b Note: methods in general should only be called after the Component has completed. +*/ +/*! + \qmlsignal QtQuick::Column::positioningComplete() + \since 5.9 + + This signal is emitted when positioning has been completed. + + The corresponding handler is \c onPositioningComplete. +*/ + QQuickColumn::QQuickColumn(QQuickItem *parent) : QQuickBasePositioner(Vertical, parent) { @@ -1077,6 +1106,27 @@ void QQuickColumn::reportConflictingAnchors() \sa Grid::spacing */ +/*! + \qmlmethod QtQuick::Row::forceLayout() + \since 5.9 + + Row typically positions its children once per frame. This means that + inside script blocks it is possible for the underlying children to have changed, + but the Row to have not yet been updated accordingly. + + This method forces the Row to immediately respond to any outstanding + changes in its children. + + \b Note: methods in general should only be called after the Component has completed. +*/ +/*! + \qmlsignal QtQuick::Row::positioningComplete() + \since 5.9 + + This signal is emitted when positioning has been completed. + + The corresponding handler is \c onPositioningComplete. +*/ class QQuickRowPrivate : public QQuickBasePositionerPrivate { @@ -1355,6 +1405,27 @@ void QQuickRow::reportConflictingAnchors() \sa rows, columns */ +/*! + \qmlmethod QtQuick::Grid::forceLayout() + \since 5.9 + + Grid typically positions its children once per frame. This means that + inside script blocks it is possible for the underlying children to have changed, + but the Grid to have not yet been updated accordingly. + + This method forces the Grid to immediately respond to any outstanding + changes in its children. + + \b Note: methods in general should only be called after the Component has completed. +*/ +/*! + \qmlsignal QtQuick::Grid::positioningComplete() + \since 5.9 + + This signal is emitted when positioning has been completed. + + The corresponding handler is \c onPositioningComplete. +*/ class QQuickGridPrivate : public QQuickBasePositionerPrivate { @@ -1920,6 +1991,28 @@ void QQuickGrid::reportConflictingAnchors() \sa Grid::spacing */ +/*! + \qmlmethod QtQuick::Flow::forceLayout() + \since 5.9 + + Flow typically positions its children once per frame. This means that + inside script blocks it is possible for the underlying children to have changed, + but the Flow to have not yet been updated accordingly. + + This method forces the Flow to immediately respond to any outstanding + changes in its children. + + + \b Note: methods in general should only be called after the Component has completed. +*/ +/*! + \qmlsignal QtQuick::Flow::positioningComplete() + \since 5.9 + + This signal is emitted when positioning has been completed. + + The corresponding handler is \c onPositioningComplete. +*/ class QQuickFlowPrivate : public QQuickBasePositionerPrivate { |