diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-09-10 18:30:22 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-09-19 11:14:36 +0200 |
commit | 217a25a6bf59bb9ce0845267f46244fedd8bcaaa (patch) | |
tree | ae54c75f951553001472d5d8bb0f54e5a4f9056c /src/corelib/kernel/qiterable.h | |
parent | 5c808073af5b8f1290602fcccf60666c9a3682f8 (diff) |
QMetaType: Allow registration of mutable views and register iterables
In order to modify a container through an iterable, we need the original
container to be mutable. The iterable, then, is not a conversion of the
container, but rather a view on the container. The concept may be
extended to other types.
In order to facilitate this, provide a set of methods in QMetaType and
QVariant similar to the convert family. The new methods are non-const
and expect the original value to stay available during the life time of
the view.
Change-Id: I363621033f7fc600edcea2acb786820ccba49c86
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/kernel/qiterable.h')
-rw-r--r-- | src/corelib/kernel/qiterable.h | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/corelib/kernel/qiterable.h b/src/corelib/kernel/qiterable.h index 8a230d5f0e..20d937591a 100644 --- a/src/corelib/kernel/qiterable.h +++ b/src/corelib/kernel/qiterable.h @@ -501,9 +501,7 @@ public: } const void *constIterable() const { return m_iterable.constPointer(); } - - // TODO: fix this when introducing mutable iterables - void *mutableIterable() { return const_cast<void *>(m_iterable.constPointer()); } + void *mutableIterable() { return m_iterable.mutablePointer(); } QConstIterator<Container> constBegin() const { |