diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2023-08-20 07:56:31 +0300 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2023-12-15 16:52:09 +0300 |
commit | 1648d2d93a9b4c9a787be01b070aa2ca1eb31099 (patch) | |
tree | 46a00ed45acd89728d2e53d650574f1686f4c5e7 /src/corelib/itemmodels/qidentityproxymodel_p.h | |
parent | d91d53c951144255349e5d246353b598179ce967 (diff) |
QIdentityProxyModel: store connection handles in a container
Port to PMF signal/slot syntax: compile-time type checking vs. run-time
string-based search. Given how many connections are made, this is both
safer and more readable.
Drop the _q_ prefix from method names, it was needed since
Q_PRIVATE_SLOT() was used for those methods.
Use QVLA since we know the size at compile time, (not a std::array like
other changes because some elements in the std::initializer_list are
going to be split out, so using a container with a push_back() is
simpler than fiddling with indexes to use operator[], see next commit in
this chain for details).
This is similar to c609b8dba0ae43aeba142164684536f808aad501, so a
similar performance improvement is expected.
Change-Id: Ia7e7d0b1f3c1a95bc399bd06de3b5c96e845b34d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Diffstat (limited to 'src/corelib/itemmodels/qidentityproxymodel_p.h')
-rw-r--r-- | src/corelib/itemmodels/qidentityproxymodel_p.h | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/src/corelib/itemmodels/qidentityproxymodel_p.h b/src/corelib/itemmodels/qidentityproxymodel_p.h index 0aa0624ab0..d36fa426da 100644 --- a/src/corelib/itemmodels/qidentityproxymodel_p.h +++ b/src/corelib/itemmodels/qidentityproxymodel_p.h @@ -33,28 +33,37 @@ public: QList<QPersistentModelIndex> layoutChangePersistentIndexes; QModelIndexList proxyIndexes; - void _q_sourceRowsAboutToBeInserted(const QModelIndex &parent, int start, int end); - void _q_sourceRowsInserted(const QModelIndex &parent, int start, int end); - void _q_sourceRowsAboutToBeRemoved(const QModelIndex &parent, int start, int end); - void _q_sourceRowsRemoved(const QModelIndex &parent, int start, int end); - void _q_sourceRowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest); - void _q_sourceRowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest); - - void _q_sourceColumnsAboutToBeInserted(const QModelIndex &parent, int start, int end); - void _q_sourceColumnsInserted(const QModelIndex &parent, int start, int end); - void _q_sourceColumnsAboutToBeRemoved(const QModelIndex &parent, int start, int end); - void _q_sourceColumnsRemoved(const QModelIndex &parent, int start, int end); - void _q_sourceColumnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest); - void _q_sourceColumnsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest); - - void _q_sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList<int> &roles); - void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last); - - void _q_sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint); - void _q_sourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint); - void _q_sourceModelAboutToBeReset(); - void _q_sourceModelReset(); + void sourceRowsAboutToBeInserted(const QModelIndex &parent, int start, int end); + void sourceRowsInserted(const QModelIndex &parent, int start, int end); + void sourceRowsAboutToBeRemoved(const QModelIndex &parent, int start, int end); + void sourceRowsRemoved(const QModelIndex &parent, int start, int end); + void sourceRowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, + const QModelIndex &destParent, int dest); + void sourceRowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, + const QModelIndex &destParent, int dest); + void sourceColumnsAboutToBeInserted(const QModelIndex &parent, int start, int end); + void sourceColumnsInserted(const QModelIndex &parent, int start, int end); + void sourceColumnsAboutToBeRemoved(const QModelIndex &parent, int start, int end); + void sourceColumnsRemoved(const QModelIndex &parent, int start, int end); + void sourceColumnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, + int sourceEnd, const QModelIndex &destParent, int dest); + void sourceColumnsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, + const QModelIndex &destParent, int dest); + + void sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, + const QList<int> &roles); + void sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last); + + void sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents, + QAbstractItemModel::LayoutChangeHint hint); + void sourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents, + QAbstractItemModel::LayoutChangeHint hint); + void sourceModelAboutToBeReset(); + void sourceModelReset(); + +private: + QVarLengthArray<QMetaObject::Connection, 18> m_sourceModelConnections; }; QT_END_NAMESPACE |