Sur cette page

QVariantPointer Class

template <typename Pointer> class QVariantPointer

QVariantPointer est une classe de modèles qui émule un pointeur vers un objet de type « QVariant » à partir d'un pointeur. En savoir plus...

En-tête : #include <qvariant.h>
CMake : find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake : QT += core
Depuis : Qt 6.0
Statut : Jusqu'à la version 6.15

Cette classe est prévue pour être obsolète dans la version 6.15.

Fonctions publiques

QVariantPointer(const Pointer *pointer)
QVariantRef<Pointer> operator*() const
Pointer operator->() const

Description détaillée

Utilisez plutôt ` QVariant::Pointer `.

QVariantPointer<Pointer> encapsule un pointeur de type Pointer et renvoie un QVariantRef à celui-ci via son opérateur *(). Cela permet de l'utiliser en remplacement d'un pointeur réel. Il n'est pas possible de renvoyer un pointeur réel à partir d'itérateurs génériques, car ceux-ci ne contiennent pas d'QVariant.

Documentation des fonctions membres

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

Crée un objet `QVariantPointer` à partir de l'pointer` fourni.

QVariantRef<Pointer> QVariantPointer::operator*() const

Déréférence l'QVariantPointer e vers un QVariantRef.

Pointer QVariantPointer::operator->() const

Déréférence le pointeur et le renvoie. Le pointeur doit également implémenter l'opérateur ->().

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