summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qsequentialiterable.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2025-09-26 11:31:04 +0200
committerUlf Hermann <ulf.hermann@qt.io>2025-12-02 16:01:49 +0100
commit9adaf8505a9eb9d7acb7fee6aeac5341aa24a074 (patch)
treed4e3875f77c590de887d5ff11a32ca699cce4426 /src/corelib/kernel/qsequentialiterable.cpp
parentcb8bb93242a57902f1cafcb0754252575ca180c8 (diff)
Core: Provide non-broken metacontainer iterables
QSequentialIterable and QAssociativeIterable are incapable of providing operator[] on their iterators because the references used by those iterators are not actually stable when the iterator is modified. The only way to fix this in a binary compatible way is to provide a complete set of new iterables and iterators. These are implemented in qmeta{association|sequence}.h and exposed through QMeta{Association|Sequence}::Iterable. In order to give users a convenient way to include those, we instruct syncqt to regard qmeta{association|sequence}.h as header to use in order to provide QMetaSequence and QMetaAssociation. These headers are the natural choice anyway. qmetacontainer.h still has to hold the (now incomplete) declarations for QMetaSequence and QMetaAssociation so that we remain source compatible. The new iterables offer a more consistent set of accessor methods and deprecate some of the old accessor methods. It makes little sense to add or remove a value from/to an iterable at an unspecified place. The new sequential iterable offers the more familiar append/prepend and removeFirst/removeLast methods. Finally, the new iterables warn when taking a slow code path that synthesizes operations not avaible on the actual container using iterators. There generally is a reason for those operations to not be available and we shouldn't second-guess the choices made by the authors of the container. For now, we have to keep those code paths intact to remain compatible with QSequentialIterable and QAssociativeIterable. Task-number: QTBUG-140181 Change-Id: I2f4c32716951fa023ae1fb8028d1a87e4c85c3a0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/kernel/qsequentialiterable.cpp')
-rw-r--r--src/corelib/kernel/qsequentialiterable.cpp4
1 files changed, 0 insertions, 4 deletions
diff --git a/src/corelib/kernel/qsequentialiterable.cpp b/src/corelib/kernel/qsequentialiterable.cpp
index 32c58266045..7325785f4d5 100644
--- a/src/corelib/kernel/qsequentialiterable.cpp
+++ b/src/corelib/kernel/qsequentialiterable.cpp
@@ -17,8 +17,6 @@ QT_BEGIN_NAMESPACE
a QVariant. An instance of QSequentialIterable can be extracted from a QVariant if it can
be converted to a QVariantList.
- \snippet code/src_corelib_kernel_qvariant.cpp 9
-
The container itself is not copied before iterating over it.
\sa QVariant
@@ -164,8 +162,6 @@ void QSequentialIterable::set(qsizetype idx, const QVariant &value)
A QSequentialIterable::const_iterator can only be created by a QSequentialIterable instance,
and can be used in a way similar to other stl-style iterators.
-
- \snippet code/src_corelib_kernel_qvariant.cpp 9
*/
/*!