在本页

QVariant::Pointer Class

template <typename Indirect> class QVariant::Pointer

QVariant::Pointer 是一个模板类,用于模拟指向QVariant 的非常数指针。更多

该类在 Qt 6.11 中引入。

公共函数

Pointer(Indirect &&pointed)
Pointer(const Indirect &pointed)
operator QVariant::ConstPointer<Indirect>() const
QVariant::Reference<Indirect> operator*() const

详细说明

QVariant::Pointer 封装指向的值,并从其 operator*() 返回QVariant::Reference 。这使它适合替代实际指针。我们不能从泛型迭代器中返回实际指针,因为迭代器并不持有实际的QVariant

成员函数文档

[explicit noexcept(...)] Pointer::Pointer(Indirect &&pointed)

pointed 到值构造QVariant::Pointer

注: std::is_nothrow_move_constructible_v<Indirect>true 时,此函数为 noexcept。

[explicit noexcept(...)] Pointer::Pointer(const Indirect &pointed)

pointed 到值构造QVariant::Pointer

注: std::is_nothrow_copy_constructible_v<Indirect>true 时,此函数为 noexcept。

[noexcept(...)] Pointer::operator QVariant::ConstPointer<Indirect>() const

QVariant::Pointer 转换为QVariant::ConstPointer

注: std::is_nothrow_copy_constructible_v<Indirect>true 时,此函数为 noexcept。

[noexcept(...)] QVariant::Reference<Indirect> Pointer::operator*() const

QVariant::Pointer 终止引用到QVariant::Reference

注: std::is_nothrow_copy_constructible_v<Indirect>true 时,此函数为 noexcept。

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