QStyleOptionComboBox Class
QStyleOptionComboBox 类用于描述绘制组合框的参数。更多
头文件: | #include <QStyleOptionComboBox> |
CMake.QStyleOptionComboBox 类 | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
qmake: | QT += widgets |
继承: | QStyleOptionComplex |
公共类型
enum | StyleOptionType { Type } |
enum | StyleOptionVersion { Version } |
公共函数
QStyleOptionComboBox() | |
QStyleOptionComboBox(const QStyleOptionComboBox &other) |
公共变量
QIcon | currentIcon |
QString | currentText |
bool | editable |
bool | frame |
QSize | iconSize |
QRect | popupRect |
Qt::Alignment | textAlignment |
详细描述
QStyleOptionButton 包含 函数绘制 所需的所有信息。QStyle QComboBox
出于性能考虑,成员函数很少,对成员变量的访问是直接的(即使用.
或->
操作符)。这使得结构使用起来非常简单,并强调这些结构只是样式函数使用的参数。
另请参见 QStyleOption,QStyleOptionComplex, 和QComboBox 。
成员类型文档
enum QStyleOptionComboBox::StyleOptionType
该枚举用于保存有关样式选项类型的信息,并为每个QStyleOption 子类定义。
常量 | 值 | 描述 |
---|---|---|
QStyleOptionComboBox::Type | SO_ComboBox | 提供的样式选项的类型(SO_ComboBox 适用于该类)。 |
QStyleOption 及其子类和qstyleoption_cast() 内部使用该类型来确定样式选项的类型。一般来说,除非您想创建自己的QStyleOption 子类和自己的样式,否则不需要担心这个问题。
另请参见 StyleOptionVersion 。
enum QStyleOptionComboBox::StyleOptionVersion
该枚举用于保存有关样式选项版本的信息,并为每个QStyleOption 子类定义。
常量 | 值 | 说明 |
---|---|---|
QStyleOptionComboBox::Version | 1 | 2 |
该版本用于QStyleOption 子类在不破坏兼容性的情况下实现扩展。如果使用qstyleoption_cast() ,通常不需要检查它。
另请参阅 StyleOptionType 。
成员函数文档
QStyleOptionComboBox::QStyleOptionComboBox()
创建 QStyleOptionComboBox,将成员变量初始化为默认值。
QStyleOptionComboBox::QStyleOptionComboBox(const QStyleOptionComboBox &other)
构建other 样式选项的副本。
成员变量文档
QIcon QStyleOptionComboBox::currentIcon
该变量用于保存组合框中当前项目的图标。
默认值为空图标,即既没有像素图也没有文件名的图标。
QString QStyleOptionComboBox::currentText
该变量用于保存组合框中当前项目的文本。
默认值为空字符串。
bool QStyleOptionComboBox::editable
该变量用于保存组合框是否可编辑
默认值为 false
另请参见 QComboBox::isEditable().
bool QStyleOptionComboBox::frame
该变量用于保存组合框是否有边框。
默认值为 true。
QSize QStyleOptionComboBox::iconSize
该变量用于保存当前组合框项的图标大小。
默认值为QSize(-1, -1), 即无效大小。
QRect QStyleOptionComboBox::popupRect
该变量用于保存组合框的弹出矩形
默认值为空矩形,即宽度和高度均设置为 0 的矩形。
该变量目前未使用。您可以放心地忽略它。
另请参见 QStyle::SC_ComboBoxListBoxPopup 。
Qt::Alignment QStyleOptionComboBox::textAlignment
该变量用于保存组合框中当前文本的对齐方式。
默认值为Qt::AlignLeft |Qt::AlignVCenter 。
© 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.