The QStyleOptionToolButton class is used to describe the parameters for drawing a tool button. 更多...
| 頭: | #include <QStyleOptionToolButton> |
| qmake: | QT += widgets |
| 繼承: | QStyleOptionComplex |
| enum | StyleOptionType { Type } |
| enum | StyleOptionVersion { Version } |
| enum | ToolButtonFeature { None, Arrow, Menu, PopupDelay, HasMenu, MenuButtonPopup } |
| flags | ToolButtonFeatures |
| QStyleOptionToolButton () | |
| QStyleOptionToolButton (const QStyleOptionToolButton & other ) |
| Qt::ArrowType | arrowType |
| ToolButtonFeatures | features |
| QFont | font |
| QIcon | icon |
| QSize | iconSize |
| QPoint | pos |
| QString | text |
| Qt::ToolButtonStyle | toolButtonStyle |
The QStyleOptionToolButton class is used to describe the parameters for drawing a tool button.
QStyleOptionToolButton contains all the information that QStyle 函數需要繪製 QToolButton .
For performance reasons, the access to the member variables is direct (i.e., using the
.
or
->
operator). This low-level feel makes the structures straightforward to use and emphasizes that these are simply parameters used by the style functions.
對於可以如何使用樣式選項的演示範例,見 樣式 範例。
另請參閱 QStyleOption , QStyleOptionComplex ,和 QStyleOptionButton .
This enum is used to hold information about the type of the style option, and is defined for each QStyleOption 子類。
| 常量 | 值 | 描述 |
|---|---|---|
QStyleOptionToolButton::Type
|
SO_ToolButton
|
提供樣式選項的類型 ( SO_ToolButton 對於此類)。 |
類型內部使用通過 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 .
This enum is used to hold information about the version of the style option, and is defined for each QStyleOption 子類。
| 常量 | 值 | 描述 |
|---|---|---|
QStyleOptionToolButton::Version
|
1
|
1 |
版本的使用通過 QStyleOption 子類以實現擴展在不破壞兼容性的情況下。若使用 qstyleoption_cast (),通常不需要校驗它。
另請參閱 StyleOptionType .
描述工具按鈕可以擁有的各種特徵。
| 常量 | 值 | 描述 |
|---|---|---|
QStyleOptionToolButton::None
|
0x00
|
A normal tool button. |
QStyleOptionToolButton::Arrow
|
0x01
|
The tool button is an arrow. |
QStyleOptionToolButton::Menu
|
0x04
|
The tool button has a menu. |
QStyleOptionToolButton::PopupDelay
|
0x08
|
There is a delay to showing the menu. |
QStyleOptionToolButton::HasMenu
|
0x10
|
The button has a popup menu. |
QStyleOptionToolButton::MenuButtonPopup
|
Menu
|
The button should display an arrow to indicate that a menu is present. |
ToolButtonFeatures 類型是 typedef 對於 QFlags <ToolButtonFeature>. It stores an OR combination of ToolButtonFeature values.
另請參閱 features , QToolButton::toolButtonStyle (),和 QToolButton::popupMode ().
構造 QStyleOptionToolButton , initializing the members variables to their default values.
構造副本為 other 樣式選項。
此變量保持工具按鈕的箭頭方嚮
This value is only used if features 包括 Arrow 。默認值為 Qt::DownArrow .
This variable holds an OR combination of the tool button's features
默認值為 None .
另請參閱 ToolButtonFeature .
This variable holds the font that is used for the text
This value is only used if toolButtonStyle is Qt::ToolButtonTextUnderIcon , Qt::ToolButtonTextBesideIcon ,或 Qt::ToolButtonTextOnly . By default, the application's default font is used.
This variable holds the icon for the tool button
默認值為空圖標 (即:圖標既沒有像素圖,也沒有文件名)。
另請參閱 iconSize .
This variable holds the size of the icon for the tool button
默認值為 QSize (-1, -1),即:無效尺寸。
This variable holds the position of the tool button
The default value is a null point, i.e. (0, 0)
This variable holds the text of the tool button
This value is only used if toolButtonStyle is Qt::ToolButtonTextUnderIcon , Qt::ToolButtonTextBesideIcon ,或 Qt::ToolButtonTextOnly . The default value is an empty string.
This variable holds a Qt::ToolButtonStyle value describing the appearance of the tool button
默認值為 Qt::ToolButtonIconOnly .
另請參閱 QToolButton::toolButtonStyle ().