diff options
author | Jan Arve Saether <jan-arve.saether@theqtcompany.com> | 2015-03-03 11:16:00 +0100 |
---|---|---|
committer | Jan Arve Sæther <jan-arve.saether@theqtcompany.com> | 2015-03-05 12:39:01 +0000 |
commit | d139d0af57abbedf9659d516b65fd50a172b297f (patch) | |
tree | 7a397a7ceb252d50a76e18851ac4784799a99200 /src/layouts/qquickgridlayoutengine_p.h | |
parent | 36f05622c5e1ba1c8842b855f998b187dc505970 (diff) | |
download | qtquickcontrols-d139d0af57abbedf9659d516b65fd50a172b297f.tar.gz |
Refactor: Move some common code up to QQuickLayout
This should make them available to other types of layouts, such as
StackLayout
* geometryChanged() is now reimplemented in QQuickLayout, and will call
the virtual rearrange()
* As a consequence, isReady() is also moved up to QQuickLayout
* invalidateSenderItem() is moved up
* Moved some of the itemChange() code up
Change-Id: I7388ff648f70ba20a1f944485724a28249524848
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/layouts/qquickgridlayoutengine_p.h')
-rw-r--r-- | src/layouts/qquickgridlayoutengine_p.h | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/layouts/qquickgridlayoutengine_p.h b/src/layouts/qquickgridlayoutengine_p.h index a94ef934..cebf168b 100644 --- a/src/layouts/qquickgridlayoutengine_p.h +++ b/src/layouts/qquickgridlayoutengine_p.h @@ -64,23 +64,18 @@ public: : QGridLayoutItem(row, column, rowSpan, columnSpan, alignment), m_item(item), sizeHintCacheDirty(true), useFallbackToWidthOrHeight(true) {} - typedef qreal (QQuickLayoutAttached::*SizeGetter)() const; - QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const { Q_UNUSED(constraint); // Quick Layouts does not support constraint atm return effectiveSizeHints()[which]; } - static void effectiveSizeHints_helper(QQuickItem *item, QSizeF *cachedSizeHints, QQuickLayoutAttached **info, bool useFallbackToWidthOrHeight); - static QLayoutPolicy::Policy effectiveSizePolicy_helper(QQuickItem *item, Qt::Orientation orientation, QQuickLayoutAttached *info); - QSizeF *effectiveSizeHints() const { if (!sizeHintCacheDirty) return cachedSizeHints; - effectiveSizeHints_helper(m_item, cachedSizeHints, 0, useFallbackToWidthOrHeight); + QQuickLayout::effectiveSizeHints_helper(m_item, cachedSizeHints, 0, useFallbackToWidthOrHeight); useFallbackToWidthOrHeight = false; sizeHintCacheDirty = false; @@ -103,7 +98,7 @@ public: QLayoutPolicy::Policy sizePolicy(Qt::Orientation orientation) const { - return effectiveSizePolicy_helper(m_item, orientation, attachedLayoutObject(m_item, false)); + return QQuickLayout::effectiveSizePolicy_helper(m_item, orientation, attachedLayoutObject(m_item, false)); } void setGeometry(const QRectF &rect) |