diff options
| author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2025-07-24 19:10:02 +0200 |
|---|---|---|
| committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2025-07-25 20:36:20 +0200 |
| commit | de156489923b5092a12a925c20a0245004622c00 (patch) | |
| tree | d6f35c5191d7da72323448d76cc66ecdea6a3dfb /src/corelib/doc/snippets | |
| parent | e97431721a6c1940355b4ee1bd821c090cc4b10c (diff) | |
QRM: cache QMetaProperties for roles
Looking up the QMetaProperty from a Qt::ItemDataRole value requires a
QHash lookup of the role name, then a lookup of the property index in
the QMetaObject, and then the (cheap) construction of the QMetaProperty
from that index.
If all items in the model are of the same meta-object type (in which
case has_metaobject<row_traits::item_type> is true at compile time),
then we can build a cache from Qt::ItemDataRole to QMetaProperty.
Give ModelData a base class that is specialized on this trait, and add
a cache to the specialization. Otherwise the base class is empty and
doesn't introduce any overhead.
Invalidate the cache when the role names change.
Pick-to: 6.10
Change-Id: I0985327e8c66a5467d4ea1da0ec62b7dfa85501f
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Diffstat (limited to 'src/corelib/doc/snippets')
0 files changed, 0 insertions, 0 deletions
