aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktableview_p.h
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-09-10 15:35:09 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-09-11 12:37:29 +0000
commit5b95cc34c15a021b0be37080b29f423144b5e64c (patch)
tree80748cfdff3a0e089cf884b9cea554edd25398c8 /src/quick/items/qquicktableview_p.h
parentf3daa8bb97bbfc7a309c2bf59de1e41d279e05d1 (diff)
QQuickTableView: don't rebuild table upon querying content size
Overriding contentWidth/Height was done to be able to force build the table early if the app needed to know the size of the table already at Component.onCompleted (to e.g center the viewport on the center of the table). But now that we have a forceLayout() function, it's better to require that that function should be called before querying contentWidth/Height at this stage. By not building the table on the fly, we allow the application to bind expressions directly to contentWidth/Height, without being concerned about potential binding loops that can occur as a result of us rebuilding the whole table behind his back. The benefit of this overshadows the need to call forceLayout() explicit for some corner cases. Note that we still redefine the contentWidth/Height properties in TableView so that we can catch if the application sets an explicit contentWidth/Height (which is tested by checkExplicitContentWidthAndHeight()). Change-Id: Ic4499b3939af1cb3a543e4c006023d0d6f12fd3b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quick/items/qquicktableview_p.h')
-rw-r--r--src/quick/items/qquicktableview_p.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/quick/items/qquicktableview_p.h b/src/quick/items/qquicktableview_p.h
index 0a2eff8fc1..6ba91d16a1 100644
--- a/src/quick/items/qquicktableview_p.h
+++ b/src/quick/items/qquicktableview_p.h
@@ -77,8 +77,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTableView : public QQuickFlickable
Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)
Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
Q_PROPERTY(bool reuseItems READ reuseItems WRITE setReuseItems NOTIFY reuseItemsChanged)
- Q_PROPERTY(qreal contentWidth READ explicitContentWidth WRITE setExplicitContentWidth NOTIFY contentWidthOverrideChanged)
- Q_PROPERTY(qreal contentHeight READ explicitContentHeight WRITE setExplicitContentWidth NOTIFY contentHeightOverrideChanged)
+ Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged)
+ Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentWidth NOTIFY contentHeightChanged)
public:
QQuickTableView(QQuickItem *parent = nullptr);
@@ -107,10 +107,8 @@ public:
bool reuseItems() const;
void setReuseItems(bool reuseItems);
- qreal explicitContentWidth() const;
- void setExplicitContentWidth(qreal width);
- qreal explicitContentHeight() const;
- void setExplicitContentHeight(qreal height);
+ void setContentWidth(qreal width);
+ void setContentHeight(qreal height);
Q_INVOKABLE void forceLayout();
@@ -126,8 +124,6 @@ Q_SIGNALS:
void modelChanged();
void delegateChanged();
void reuseItemsChanged();
- void contentWidthOverrideChanged();
- void contentHeightOverrideChanged();
protected:
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;