diff options
author | Robin Burchell <robin.burchell@viroteck.net> | 2016-07-08 13:25:02 +0200 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2016-11-30 08:31:52 +0000 |
commit | 3b4f00ecb54432f514f184c251a316896a88f91a (patch) | |
tree | f39299a24451d8e7f7beb17eb314247d5481c2fc /src/imports/layouts/qquicklinearlayout_p.h | |
parent | 39496a40748be1d60c909ba679c45c788ec6412f (diff) |
Layouts: Use QQuickItemChangeListener for more things
Signal connections are expensive: even with qmlobject_connect, there's a bunch
of memory allocation. By avoiding the signal connections, we can do the same
thing essentially, a little faster.
This gives me another 15-20 RowLayout instances per frame when testing with
RowLayout containing 5 Rectangles on qmlbench (from ~139 to ~155 ops/frame).
Change-Id: I4448a28128dc251e40b6b06d642bae716af212f4
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/imports/layouts/qquicklinearlayout_p.h')
-rw-r--r-- | src/imports/layouts/qquicklinearlayout_p.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/imports/layouts/qquicklinearlayout_p.h b/src/imports/layouts/qquicklinearlayout_p.h index 86404f8d79..c289416540 100644 --- a/src/imports/layouts/qquicklinearlayout_p.h +++ b/src/imports/layouts/qquicklinearlayout_p.h @@ -77,6 +77,10 @@ public: Qt::LayoutDirection effectiveLayoutDirection() const; void setAlignment(QQuickItem *item, Qt::Alignment align) Q_DECL_OVERRIDE; + /* QQuickItemChangeListener */ + void itemDestroyed(QQuickItem *item) Q_DECL_OVERRIDE; + void itemVisibilityChanged(QQuickItem *item) Q_DECL_OVERRIDE; + protected: void updateLayoutItems() Q_DECL_OVERRIDE; QQuickItem *itemAt(int index) const Q_DECL_OVERRIDE; @@ -84,15 +88,10 @@ protected: void rearrange(const QSizeF &size) Q_DECL_OVERRIDE; virtual void insertLayoutItems() {} - void itemChange(ItemChange change, const ItemChangeData &data) Q_DECL_OVERRIDE; signals: Q_REVISION(1) void layoutDirectionChanged(); -protected slots: - void onItemVisibleChanged(); - void onItemDestroyed(); - private: void removeGridItem(QGridLayoutItem *gridItem); Q_DECLARE_PRIVATE(QQuickGridLayoutBase) |