QVariantConstPointer Class

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

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

Public Functions

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

Detailed Description

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

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->().

© 2022 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.