diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2019-09-24 15:29:00 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2019-12-04 01:34:39 +0100 |
commit | 8c72e634b3b0eacbfdee883bfc34994d3c19ed77 (patch) | |
tree | ce566dd9705f0a254bc776cfd9f40a90f56b0916 /src/qmlmodels/qqmldelegatemodel_p.h | |
parent | 4b58d69d56c5876a1b1d71ce6a96b4c6c81a833f (diff) |
QQmlDelegateModel: implement support for reusing items
Take the shared reuse pool into use, and implement delegate
item recycling in QQmlDelegateModel. The implementation is
more or less a copy of the strategy followed in
QQmlTableInstanceModel.
Change-Id: I80953ec617f586774a240e7c6790b7777e7b64b8
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/qmlmodels/qqmldelegatemodel_p.h')
-rw-r--r-- | src/qmlmodels/qqmldelegatemodel_p.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/qmlmodels/qqmldelegatemodel_p.h b/src/qmlmodels/qqmldelegatemodel_p.h index 6db5768f63..adb5f7008b 100644 --- a/src/qmlmodels/qqmldelegatemodel_p.h +++ b/src/qmlmodels/qqmldelegatemodel_p.h @@ -113,12 +113,15 @@ public: int count() const override; bool isValid() const override { return delegate() != nullptr; } QObject *object(int index, QQmlIncubator::IncubationMode incubationMode = QQmlIncubator::AsynchronousIfNested) override; - ReleaseFlags release(QObject *object, ReusableFlag reusable = NotReusable) override; + ReleaseFlags release(QObject *object, ReusableFlag reusableFlag = NotReusable) override; void cancel(int index) override; QVariant variantValue(int index, const QString &role) override; void setWatchedRoles(const QList<QByteArray> &roles) override; QQmlIncubator::Status incubationStatus(int index) override; + void drainReusableItemsPool(int maxPoolTime) override; + int poolSize() override; + int indexOf(QObject *object, QObject *objectContext) const override; QString filterGroup() const; @@ -141,6 +144,8 @@ Q_SIGNALS: void defaultGroupsChanged(); void rootIndexChanged(); void delegateChanged(); + void itemPooled(int index, QObject *object); + void itemReused(int index, QObject *object); private Q_SLOTS: void _q_itemsChanged(int index, int count, const QVector<int> &roles); |