QVariantRef Class

template <typename Pointer> class QVariantRef

QVariantRef 充当QVariant 的非常数引用 ... 更多...

头文件: #include <QVariantRef>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
Qt 6.0

公共函数

QVariantRef(const Pointer *pointer)
QVariant operator QVariant() const
QVariantRef<Pointer> &operator=(QVariantRef<Pointer> &&value)
QVariantRef<Pointer> &operator=(const QVariant &value)
QVariantRef<Pointer> &operator=(const QVariantRef<Pointer> &value)

详细说明

由于泛型迭代器不会在每一步都实例化一个QVariant ,因此无法从 operator*() 返回一个引用。QVariantRef 提供的功能与实际引用QVariant 的功能相同,但由作为模板参数给出的指针支持。该模板适用于 QSequentialIterator 和 QAssociativeIterator 类型的指针。

成员函数文档

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

pointer 创建 QVariantRef。

QVariant QVariantRef::operator QVariant() const

QVariantRef 转换为实际的QVariant

QVariantRef<Pointer> &QVariantRef::operator=(QVariantRef<Pointer> &&value)

QVariantRef 所指指针指向的值分配一个新的value

QVariantRef<Pointer> &QVariantRef::operator=(const QVariant &value)

QVariantRef 所指指针指向的值分配一个新的value

QVariantRef<Pointer> &QVariantRef::operator=(const QVariantRef<Pointer> &value)

QVariantRef 所指指针指向的值分配一个新的value

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