QStyleOptionProgressBar 类

QStyleOptionProgressBar 类是用于描述绘制进度条所需的参数。 更多...

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

公共类型

enum StyleOptionType { Type }
enum StyleOptionVersion { Version }

公共函数

QStyleOptionProgressBar ()
QStyleOptionProgressBar (const QStyleOptionProgressBar & other )

公共变量

bool bottomToTop
bool invertedAppearance
int maximum
int minimum
int progress
QString text
Qt::Alignment textAlignment
bool textVisible

详细描述

An instance of the QStyleOptionProgressBar class has type SO_ProgressBar and version 2.

类型内部使用通过 QStyleOption ,其子类,和 qstyleoption_cast () to determine the type of style option. In general you do not need to worry about this unless you want to create your own QStyleOption subclass and your own styles. The version is used by QStyleOption 子类以实现扩展在不破坏兼容性的情况下。若使用 qstyleoption_cast (),通常不需要校验它。

出于性能原因,有很少成员函数,且对成员变量的访问是直接的 (即:使用 . or -> 运算符)。这使结构易于使用并强调这些只需通过样式函数使用参数。

对于可以如何使用样式选项的演示范例,见 样式 范例。

另请参阅 QStyleOption .

成员类型文档编制

enum QStyleOptionProgressBar:: StyleOptionType

This enum is used to hold information about the type of the style option, and is defined for each QStyleOption 子类。

常量 描述
QStyleOptionProgressBar::Type SO_ProgressBar 提供样式选项的类型 ( SO_ProgressBar 对于此类)。

类型内部使用通过 QStyleOption ,其子类,和 qstyleoption_cast () to determine the type of style option. In general you do not need to worry about this unless you want to create your own QStyleOption subclass and your own styles.

另请参阅 StyleOptionVersion .

enum QStyleOptionProgressBar:: StyleOptionVersion

This enum is used to hold information about the version of the style option, and is defined for each QStyleOption 子类。

常量 描述
QStyleOptionProgressBar::Version 1 2

版本的使用通过 QStyleOption 子类以实现扩展在不破坏兼容性的情况下。若使用 qstyleoption_cast (),通常不需要校验它。

另请参阅 StyleOptionType .

成员函数文档编制

QStyleOptionProgressBar:: QStyleOptionProgressBar ()

Constructs a QStyleOptionProgressBar, initializing the members variables to their default values.

QStyleOptionProgressBar:: QStyleOptionProgressBar (const QStyleOptionProgressBar & other )

构造副本为 other 样式选项。

成员变量文档编制

bool QStyleOptionProgressBar:: bottomToTop

This variable holds whether the text reads from bottom to top when the progress bar is vertical

默认值为 false。

另请参阅 QProgressBar::textDirection .

bool QStyleOptionProgressBar:: invertedAppearance

This variable holds whether the progress bar's appearance is inverted

默认值为 false。

另请参阅 QProgressBar::invertedAppearance .

int QStyleOptionProgressBar:: maximum

This variable holds the maximum value for the progress bar

This is the maximum value in the progress bar. The default value is 0.

另请参阅 QProgressBar::maximum .

int QStyleOptionProgressBar:: minimum

This variable holds the minimum value for the progress bar

This is the minimum value in the progress bar. The default value is 0.

另请参阅 QProgressBar::minimum .

int QStyleOptionProgressBar:: progress

This variable holds the current progress for the progress bar

The current progress. A value of QStyleOptionProgressBar::minimum - 1 indicates that the progress hasn't started yet. The default value is 0.

另请参阅 QProgressBar::value .

QString QStyleOptionProgressBar:: text

This variable holds the text for the progress bar

The progress bar text is usually just the progress expressed as a string. An empty string indicates that the progress bar has not started yet. The default value is an empty string.

另请参阅 QProgressBar::text .

Qt::Alignment QStyleOptionProgressBar:: textAlignment

This variable holds the text alignment for the text in the QProgressBar

This can be used as a guide on where the text should be in the progress bar. The default value is Qt::AlignLeft .

bool QStyleOptionProgressBar:: textVisible

This variable holds a flag indicating whether or not text is visible

If this flag is true then the text is visible. Otherwise, the text is not visible. The default value is false.

另请参阅 QProgressBar::textVisible .