QVariant::Reference Class

template <typename Indirect> class QVariant::Reference

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

This class was introduced in Qt 6.11.

Public Functions

Reference(Indirect &&referred)
Reference(const Indirect &referred)
Reference(const QVariant::Reference<Indirect> &)
Reference(QVariant::Reference<Indirect> &&)
~Reference()
operator QVariant() const
QVariant::Reference<Indirect> &operator=(QVariant::ConstReference<Indirect> &&value)
QVariant::Reference<Indirect> &operator=(QVariant::Reference<Indirect> &&value)
QVariant::Reference<Indirect> &operator=(const QVariant &value)
QVariant::Reference<Indirect> &operator=(const QVariant::ConstReference<Indirect> &value)
QVariant::Reference<Indirect> &operator=(const QVariant::Reference<Indirect> &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*(). QVariant::Reference<Indirect> provides the same functionality as an actual reference to a QVariant would, but is backed by a referred-to value of type Indirect. The template is implemented for QMetaSequence::Iterator and QMetaAssociation::Iterator.

Member Function Documentation

[explicit noexcept(...)] Reference::Reference(Indirect &&referred)

Creates a QVariant::Reference from a referred.

Note: This function is noexcept when std::is_nothrow_move_constructible_v<Indirect> is true.

[explicit noexcept(...)] Reference::Reference(const Indirect &referred)

Creates a QVariant::Reference from a referred.

Note: This function is noexcept when std::is_nothrow_copy_constructible_v<Indirect> is true.

[default] Reference::Reference(const QVariant::Reference<Indirect> &)

Copy-constructs an instance of Reference.

[delete] Reference::Reference(QVariant::Reference<Indirect> &&)

Move-constructs an instance of Reference. This function is deleted.

[default] Reference::~Reference()

Destroys the instance of Reference.

[noexcept(...)] Reference::operator QVariant() const

Dereferences the reference to a QVariant. By default this instantiates a temporary QVariant::ConstReference and calls dereferences that. In cases where instantiating a temporary ConstReference is expensive, this method should be specialized.

Note: This function is noexcept when Indirect::CanNoexceptConvertToQVariant is true.

[noexcept(...)] QVariant::Reference<Indirect> &Reference::operator=(QVariant::ConstReference<Indirect> &&value)

Assigns a new value to the value referred to by this QVariant::Reference.

Note: This function is noexcept when Indirect::CanNoexceptAssignQVariant is true.

[noexcept(...)] QVariant::Reference<Indirect> &Reference::operator=(QVariant::Reference<Indirect> &&value)

Assigns a new value to the value referred to by this QVariant::Reference.

Note: This function is noexcept when Indirect::CanNoexceptAssignQVariant is true.

[noexcept(...)] QVariant::Reference<Indirect> &Reference::operator=(const QVariant &value)

Assigns a new value to the value referred to by this QVariant::Reference. This method needs to be specialized for each Indirect type. It is pre-defined for QMetaSequence::Iterator and QMetaAssociation::Iterator.

Note: This function is noexcept when Indirect::CanNoexceptAssignQVariant is true.

[noexcept(...)] QVariant::Reference<Indirect> &Reference::operator=(const QVariant::ConstReference<Indirect> &value)

Assigns a new value to the value referred to by this QVariant::Reference.

Note: This function is noexcept when Indirect::CanNoexceptAssignQVariant is true.

[noexcept(...)] QVariant::Reference<Indirect> &Reference::operator=(const QVariant::Reference<Indirect> &value)

Assigns a new value to the value referred to by this QVariant::Reference.

Note: This function is noexcept when Indirect::CanNoexceptAssignQVariant is true.