QVariant::Reference Class

template <typename Referred> 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(Referred &&referred)
Reference(const Referred &referred)
QVariant operator QVariant() const
QVariant::Reference<Referred> &operator=(QVariant::Reference<Referred> &&value)
QVariant::Reference<Referred> &operator=(const QVariant &value)
QVariant::Reference<Referred> &operator=(const QVariant::Reference<Referred> &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 provides the same functionality as an actual reference to a QVariant would, but is backed a referred-to value given as template parameter. The template is implemented for QMetaSequence::Iterator and QMetaAssociation::Iterator.

Member Function Documentation

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

Creates a QVariant::Reference from a referred.

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

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

Creates a QVariant::Reference from a referred.

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

[noexcept(...)] QVariant 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 Referred::canNoexceptConvertToQVariant is true.

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

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

Note: This function is noexcept when Referred::canNoexceptAssignQVariant is true.

[noexcept(...)] QVariant::Reference<Referred> &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 Referred type. It is pre-defined for QMetaSequence::Iterator and QMetaAssociation::Iterator.

Note: This function is noexcept when Referred::canNoexceptAssignQVariant is true.

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

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

Note: This function is noexcept when Referred::canNoexceptAssignQVariant is true.