QVariantConstPointer Class | Qt Core | Qt 6.11.2
Description: Emulated const pointer to QVariant based on a pointer.

- Qt 6.11
- Qt Core
- C++ Classes
- QVariantConstPointer
- Qt 6.11.2 Reference Documentation

# QVariantConstPointer Class

Emulated const pointer to QVariant based on a pointer. More...

Header: | `#include <QVariantConstPointer>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS Core)` `target_link_libraries(mytarget PRIVATE Qt6::Core)`
qmake: | `QT += core`
Since: | Qt 6.0
Status: | Until 6.15

This class is scheduled for deprecation in version 6.15.

- List of all members, including inherited members

## Public Functions

| QVariantConstPointer(QVariant variant)
QVariant | operator*() const
const QVariant * | operator->() const

## Detailed Description

Use QVariant::ConstPointer instead.

QVariantConstPointer wraps a QVariant and returns it from its operator*(). This makes it suitable as replacement for an actual const pointer. We cannot return an actual const pointer from generic iterators as the iterators don't hold an actual QVariant.

## Member Function Documentation

### `[explicit]` QVariantConstPointer::QVariantConstPointer(QVariant variant)

Constructs a QVariantConstPointer from a variant.

### QVariant QVariantConstPointer::operator*() const

Dereferences the QVariantConstPointer to retrieve its internal QVariant.

### const QVariant *QVariantConstPointer::operator->() const

Returns a const pointer to the QVariant, conforming to the conventions for operator->().