QVariantRef Class

template <typename Pointer> class QVariantRef

The QVariantRef acts as a non-const reference to a QVariant. More...

Header: #include <QVariantRef>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
Since: Qt 6.0

Public Functions

QVariantRef(const Pointer *pointer)
QVariant operator QVariant() const
QVariantRef<Pointer> &operator=(const QVariant &value)
QVariantRef<Pointer> &operator=(const QVariantRef<Pointer> &value)
QVariantRef<Pointer> &operator=(QVariantRef<Pointer> &&value)

Detailed Description

As the generic iterators don't actually instantiate a QVariant on each step, they cannot return a reference to one from operator*(). QVariantRef provides the same functionality as an actual reference to a QVariant would, but is backed by a pointer given as template parameter. The template is implemented for pointers of type QSequentialIterator and QAssociativeIterator.

Member Function Documentation

[explicit] QVariantRef::QVariantRef(const Pointer *pointer)

Creates a QVariantRef from an pointer.

QVariant QVariantRef::operator QVariant() const

Resolves the QVariantRef to an actual QVariant.

QVariantRef<Pointer> &QVariantRef::operator=(const QVariant &value)

Assigns a new value to the value pointed to by the pointer this QVariantRef refers to.

QVariantRef<Pointer> &QVariantRef::operator=(const QVariantRef<Pointer> &value)

Assigns a new value to the value pointed to by the pointer this QVariantRef refers to.

QVariantRef<Pointer> &QVariantRef::operator=(QVariantRef<Pointer> &&value)

Assigns a new value to the value pointed to by the pointer this QVariantRef refers to.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.