summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/snippets
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2025-07-11 10:56:51 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2025-07-21 15:28:21 +0200
commit0f446ecdb2d50c0b3699b431933ccb1f9fe6b07b (patch)
tree02b9f532e48b0a48a28f9f28817d32cdb4ab16ff /src/corelib/doc/snippets
parente7de5cd6ca78963bbc6707e6201e1e37aa9033da (diff)
QRangeModel: remove the need for the MultiColumn wrapper
So far, the row_traits specialization has been ambiguous for types that have both a meta object, and are tuple-like. That doesn't have to be so: we can explicitly specialize the traits for each combination, and when both are present, select one of them. Implementing tuple-protocol for a gadget or QObject type is a rather explicit choice, so we interpret such types as tuples. This also gets rid of the make_void helper. Adjust test and documentation. The way that we used pointers to stack- allocated objects in the test was fishy anyway, and we are now always using the table protocol for those models, which deletes the row instances for us. SingleColumns can also be used to represent a range as a value instead of a multi-column item, and to explicitly request a type with meta type to be interpreted as a multi-role item. So we leave it, at least for now, even though it's clumsy to use. Might be best to get rid of it as well and just document that a single-element tuple can be used instead. Pick-to: 6.10 Change-Id: If5abd20e2dd44e793f4de52d778e8d723f1fa584 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Diffstat (limited to 'src/corelib/doc/snippets')
-rw-r--r--src/corelib/doc/snippets/qrangemodel/main.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/doc/snippets/qrangemodel/main.cpp b/src/corelib/doc/snippets/qrangemodel/main.cpp
index 240990e4381..4730a3c9ceb 100644
--- a/src/corelib/doc/snippets/qrangemodel/main.cpp
+++ b/src/corelib/doc/snippets/qrangemodel/main.cpp
@@ -499,7 +499,7 @@ void color_list() {
QList<QRangeModel::SingleColumn<ColorEntry>> colors;
colors.reserve(colorNames.size());
for (const QString &name : colorNames)
- colors << ColorEntry{name};
+ colors << name;
QRangeModel colorModel(colors);
QListView list;