diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/quick/items/qquickitemsmodule.cpp | 4 | ||||
| -rw-r--r-- | src/quick/items/qquickpositioners.cpp | 93 | ||||
| -rw-r--r-- | src/quick/items/qquickpositioners_p.h | 3 |
3 files changed, 100 insertions, 0 deletions
diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index 0b325d7fa8..5bba52ed73 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -380,6 +380,10 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType<QQuickTouchPoint>(uri, 2, 9, "TouchPoint"); qRegisterMetaType<QPointingDeviceUniqueId>("QPointingDeviceUniqueId"); qmlRegisterUncreatableType<QPointingDeviceUniqueId>(uri, 2, 9, "PointingDeviceUniqueId", QQuickTouchPoint::tr("PointingDeviceUniqueId is only available via read-only properties")); +#if QT_CONFIG(quick_positioners) + qmlRegisterUncreatableType<QQuickBasePositioner, 9>(uri, 2, 9, "Positioner", + QStringLiteral("Positioner is an abstract type that is only available as an attached property.")); +#endif } static void initResources() 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 { diff --git a/src/quick/items/qquickpositioners_p.h b/src/quick/items/qquickpositioners_p.h index c25ecd6dbc..ae6e795794 100644 --- a/src/quick/items/qquickpositioners_p.h +++ b/src/quick/items/qquickpositioners_p.h @@ -155,6 +155,8 @@ public: void setBottomPadding(qreal padding); void resetBottomPadding(); + Q_REVISION(9) Q_INVOKABLE void forceLayout(); + protected: QQuickBasePositioner(QQuickBasePositionerPrivate &dd, PositionerType at, QQuickItem *parent); void componentComplete() Q_DECL_OVERRIDE; @@ -172,6 +174,7 @@ Q_SIGNALS: Q_REVISION(6) void leftPaddingChanged(); Q_REVISION(6) void rightPaddingChanged(); Q_REVISION(6) void bottomPaddingChanged(); + Q_REVISION(9) void positioningComplete(); protected Q_SLOTS: void prePositioning(); |
