Nesta página

QVariantPointer Class

template <typename Pointer> class QVariantPointer

QVariantPointer é uma classe modelo que emula um ponteiro para um QVariant, com base em um ponteiro. Mais...

Cabeçalho: #include <qvariant.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
Desde: Qt 6.0
Status: Até a versão 6.15

Esta classe está programada para ser descontinuada na versão 6.15.

Funções públicas

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

Descrição detalhada

Use ` QVariant::Pointer ` em vez disso.

QVariantPointer<Pointer> encapsula um ponteiro do tipo Pointer e retorna um QVariantRef a ele por meio de seu operador *(). Isso a torna adequada como substituto para um ponteiro real. Não é possível retornar um ponteiro real a partir de iteradores genéricos, pois os iteradores não mantêm um QVariant real.

Documentação das funções-membro

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

Cria um `QVariantPointer` a partir do ` pointer` fornecido.

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

Desreferencia o ` QVariantPointer ` para um ` QVariantRef`.

Pointer QVariantPointer::operator->() const

Desreferencia e retorna o ponteiro. Espera-se que o ponteiro também implemente o operador->().

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