本页内容

QStyleOptionRubberBand Class

QStyleOptionRubberBand 类用于描述绘制橡皮筋所需的参数。更多内容...

头文件: #include <QStyleOptionRubberBand>
CMake: find_package(Qt6 REQUIRED COMPONENTS Widgets)
target_link_libraries(mytarget PRIVATE Qt6::Widgets)
qmake: QT += widgets
继承自: QStyleOption

公共类型

enum StyleOptionType { Type }
enum StyleOptionVersion { Version }

公共函数

QStyleOptionRubberBand()
QStyleOptionRubberBand(const QStyleOptionRubberBand &other)
QStyleOptionRubberBand &operator=(const QStyleOptionRubberBand &)

公共变量

bool opaque
QRubberBand::Shape shape

详细说明

QStyleOptionRubberBand 包含QStyle 函数绘制QRubberBand 所需的所有信息。

出于性能考虑,该结构体中的成员函数较少,且可直接访问成员变量(即使用. 或-> 运算符)。这使得该结构体的使用非常直观,同时也强调了这些仅仅是样式函数所使用的参数。

另请参阅 QStyleOption 和QRubberBand 。

成员类型文档

enum QStyleOptionRubberBand::StyleOptionType

该枚举用于存储样式选项类型的相关信息,并针对每个QStyleOption 子类分别定义。

常量常量值描述
QStyleOptionRubberBand::TypeSO_RubberBand提供的样式选项的类型(对于此类而言为SO_RubberBand )。

该类型由QStyleOption 、其子类以及qstyleoption_cast()在内部使用,以确定样式选项的类型。通常情况下,除非你想创建自己的QStyleOption 子类和自己的样式,否则无需担心这一点。

另请参阅 StyleOptionVersion 。

enum QStyleOptionRubberBand::StyleOptionVersion

该枚举用于存储样式选项的版本信息,并针对每个QStyleOption 子类分别定义。

常量常量值描述
QStyleOptionRubberBand::Version11

QStyleOption 的子类使用该版本在不破坏兼容性的前提下实现扩展。如果您使用qstyleoption_cast(),通常无需检查该版本。

另请参阅 StyleOptionType 。

成员函数文档

QStyleOptionRubberBand::QStyleOptionRubberBand()

创建一个 QStyleOptionRubberBand,并将成员变量初始化为默认值。

QStyleOptionRubberBand::QStyleOptionRubberBand(const QStyleOptionRubberBand &other)

创建other 样式选项的副本。

[noexcept default] QStyleOptionRubberBand &QStyleOptionRubberBand::operator=(const QStyleOptionRubberBand &)

将other 通过复制赋值给此QStyleOptionRubberBand 实例。

成员变量文档

bool QStyleOptionRubberBand::opaque

该变量用于指定是否要求弹性线以不透明样式绘制

默认值为 true。

QRubberBand::Shape QStyleOptionRubberBand::shape

该变量存储橡皮筋的形状

默认形状为QRubberBand::Line 。

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