Qt 样式表支持各种特性、伪状态及子控件 (使定制 Widget 外观成为可能)。
下表列出可以使用样式表进行定制的 Qt Widgets:
Widget | 如何样式化 |
---|---|
QAbstractScrollArea |
支持
Box 模型
.
所有衍生的
QAbstractScrollArea
,包括
QTextEdit
,和
QAbstractItemView
(所有项视图类),支持可卷动背景使用
background-attachment
. Setting the background-attachment to
见 定制 QAbstractScrollArea 范例。 |
QCheckBox |
支持
Box 模型
。可以样式化复选指示器使用
::indicator
子控件。默认情况下,指示器放在 Widget 内容矩形的左上角。
The spacing 特性指定复选指示器和文本之间的间距。 见 定制 QCheckBox 范例。 |
QColumnView | 握把的样式化可以使用 image 特性。箭头指示器的样式化可以使用 ::left-arrow 子控件和 ::right-arrow 子控件。 |
QComboBox |
The frame around the combobox can be styled using the
Box 模型
. The drop-down button can be styled using the
::drop-down
subcontrol. By default, the drop-down button is placed in the top right corner of the padding rectangle of the widget. The arrow mark inside the drop-down button can be styled using the
::down-arrow
subcontrol. By default, the arrow is placed in the center of the contents rectangle of the drop-down subcontrol.
见 定制 QComboBox 范例。 |
QDateEdit | 见 QSpinBox . |
QDateTimeEdit | 见 QSpinBox . |
QDialog |
仅支持
background
,
background-clip
and
background-origin
特性。
警告: 确保定义 Q_OBJECT 宏为自定义 Widget。 |
QDialogButtonBox | The layout of buttons can be altered using the button-layout 特性。 |
QDockWidget |
Supports styling of the title bar and the title bar buttons when docked. The dock widget border can be styled using the border property. The ::title subcontrol can be used to customize the title bar. The close and float buttons are positioned with respect to the ::title subcontrol using the ::close-button and ::float-button 分别。 When the title bar is vertical, the :vertical pseudo class is set. In addition, depending on QDockWidget::DockWidgetFeature , :closable , :floatable and :movable pseudo states are set. 注意: 使用 QMainWindow::separator 以样式化重置手柄大小。 警告: 样式表不起作用当 QDockWidget is undocked as Qt uses native top level windows when undocked. 见 定制 QDockWidget 范例。 |
QDoubleSpinBox | 见 QSpinBox . |
QFrame |
支持
Box 模型
.
从 4.3 起,设置样式表在 QLabel 自动设置 QFrame::frameStyle 特性到 QFrame::StyledPanel . 见 定制 QFrame 范例。 |
QGroupBox |
支持
Box 模型
. The title can be styled using the
::title
subcontrol. By default, the title is placed depending on QGroupBox::textAlignment.
In the case of a checkable QGroupBox , the title includes the check indicator. The indicator is styled using the ::indicator 子控件。 spacing property can be used to control the spacing between the text and indicator. 见 定制 QGroupBox 范例。 |
QHeaderView |
支持
Box 模型
. The sections of the header view are styled using the
::section
子控件。
section
子控件支持
:middle
,
:first
,
:last
,
:only-one
,
:next-selected
,
:previous-selected
,
:selected
,和
:checked
伪状态。
The sort indicator can be styled using the ::up-arrow 和 ::down-arrow 子控件。 见 定制 QHeaderView 范例。 |
QLabel |
支持
Box 模型
。不支持
:hover
伪状态。
从 4.3 起,设置样式表在 QLabel 自动设置 QFrame::frameStyle 特性到 QFrame::StyledPanel . |
QLineEdit |
支持
Box 模型
.
样式化选中项的颜色和背景是使用 selection-color and selection-background-color 分别。 The password character can be styled using the lineedit-password-character 特性。 The password mask delay can be changed using the lineedit-password-mask-delay 见 定制 QLineEdit 范例。 |
QListView |
支持
Box 模型
。当
交替行颜色
被启用,样式化交替颜色可以使用
alternate-background-color
特性。
样式化选中项的颜色和背景是使用 selection-color and selection-background-color 分别。 选定行为的控制是通过 show-decoration-selected 特性。 使用 ::item subcontrol for more fine grained control over the items in the QListView . 见 QAbsractScrollArea 以样式化可卷动背景。 见 定制 QListView 范例。 |
QListWidget | 见 QListView . |
QMainWindow |
支持分隔符样式化
分隔符在 QMainWindow 当使用 QDockWidget 的样式化是使用 ::separator 子控件。 见 定制 QMainWindow 范例。 |
QMenu |
支持
Box 模型
.
Individual items are styled using the
::item
subcontrol. In addition to the usually supported pseudo states,
The indicator of checkable menu items is styled using the ::indicator 子控件。 The separator is styled using the ::separator 子控件。 For items with a sub menu, the arrow marks are styled using the right-arrow and left-arrow . The scroller is styled using the ::scroller . The tear-off is styled using the ::tearoff . 见 定制 QMenu 范例。 |
QMenuBar |
支持
Box 模型
。
spacing
property specifies the spacing between menu items. Individual items are styled using the
::item
子控件。
警告: When running on Qt/Mac, the menu bar is usually embedded into the system-wide menu bar. In this case, the style sheet will have no effect. 见 定制 QMenuBar 范例。 |
QMessageBox | The messagebox-text-interaction-flags property can be used to alter the interaction with text in the message box. |
QProgressBar |
支持
Box 模型
. The chunks of the progress bar can be styled using the
::chunk
subcontrol. The chunk is displayed on the Contents rectangle of the widget.
If the progress bar displays text, use the text-align property to position the text. 不确定的进度条拥有 :indeterminate 伪状态设置。 见 定制 QProgressBar 范例。 |
QPushButton |
支持
Box 模型
。支持
:default
,
:flat
,
:checked
伪状态。
For QPushButton with a menu, the menu indicator is styled using the ::menu-indicator subcontrol. Appearance of checkable push buttons can be customized using the :open and :closed pseudo-states. 警告: If you only set a background-color on a QPushButton , the background may not appear unless you set the border property to some value. This is because, by default, the QPushButton draws a native border which completely overlaps the background-color. For example, QPushButton { background-color: red; border: none; } 见 定制 QPushButton 范例。 |
QRadioButton |
支持
Box 模型
。可以样式化复选指示器使用
::indicator
子控件。默认情况下,指示器放在 Widget 内容矩形的左上角。
The spacing 特性指定复选指示器和文本之间的间距。 见 定制 QRadioButton 范例。 |
QScrollBar |
支持
Box 模型
. The Contents rectangle of the widget is considered to be the groove over which the slider moves. The extent of the
QScrollBar
(i.e the width or the height depending on the orientation) is set using the
width
or
height
property respectively. To determine the orientation, use the
:horizontal
和
:vertical
伪状态。
The slider can be styled using the ::handle subcontrol. Setting the min-width or min-height provides size contraints for the slider depending on the orientation. The ::add-line subcontrol can be used to style the button to add a line. By default, the add-line subcontrol is placed in top right corner of the Border rectangle of the widget. Depending on the orientation the ::right-arrow or ::down-arrow . By default, the arrows are placed in the center of the Contents rectangle of the add-line subcontrol. The ::sub-line subcontrol can be used to style the button to subtract a line. By default, the sub-line subcontrol is placed in bottom right corner of the Border rectangle of the widget. Depending on the orientation the ::left-arrow or ::up-arrow . By default, the arrows are placed in the center of the Contents rectangle of the sub-line subcontrol. The ::sub-page subcontrol can be used to style the region of the slider that subtracts a page. The ::add-page subcontrol can be used to style the region of the slider that adds a page. 见 定制 QScrollBar 范例。 |
QSizeGrip |
支持
width
,
height
,和
image
特性。
见 定制 QSizeGrip 范例。 |
QSlider |
支持
Box 模型
。对于水平滑动,
min-width
and
height
特性必须提供。对于垂直滑块,
min-height
and
width
特性必须提供。
The groove of the slider is styled using the ::groove . The groove is positioned by default in the Contents rectangle of the widget. The thumb of the slider is styled using ::handle subcontrol. The subcontrol moves in the Contents rectangle of the groove subcontrol. 见 定制 QSlider 范例。 |
QSpinBox |
The frame of the spin box can be styled using the
Box 模型
.
The up button and arrow can be styled using the ::up-button and ::up-arrow subcontrols. By default, the up-button is placed in the top right corner in the Padding rectangle of the widget. Without an explicit size, it occupies half the height of its reference rectangle. The up-arrow is placed in the center of the Contents rectangle of the up-button. The down button and arrow can be styled using the ::down-button and ::down-arrow subcontrols. By default, the down-button is placed in the bottom right corner in the Padding rectangle of the widget. Without an explicit size, it occupies half the height of its reference rectangle. The bottom-arrow is placed in the center of the Contents rectangle of the bottom-button. 见 定制 QSpinBox 范例。 |
QSplitter |
支持
Box 模型
。分割器手柄的样式化是使用
::handle
子控件。
见 定制 QSplitter 范例。 |
QStatusBar |
仅支持
background
特性。单个项框架的样式化可以使用
::item
子控件。
见 定制 QStatusBar 范例。 |
QTabBar |
单个选项卡的样式化可以使用
::tab
子控件。关闭按钮使用
::close-button
选项卡支持
:only-one
,
:first
,
:last
,
:middle
,
:previous--selected
,
:next-selected
,
:selected
伪状态。
The :top , :left , :right , :bottom 伪状态从属选项卡取向。
selected 状态重叠选项卡的创建可以使用负边距或使用
撕裂指示器对于 QTabBar 的样式化是使用 ::tear 子控件。
QTabBar
使用两 QToolButton 的滚动器的样式化可以使用
选项卡的对齐方式在 QTabBar 的样式化是使用 alignment 特性。 警告: 要改变位置对于 QTabBar 在 QTabWidget ,使用 tab-bar 子控件 (并设置 subcontrol-position)。 见 Customizing QTabBar 范例。 |
QTabWidget |
QTabWidget 框架的的样式化是使用
::pane
子控件。左右角落的样式化是使用
::left-corner
and
::right-corner
分别。选项卡栏位置的控制是使用
::tab-bar
子控件。
默认情况下,子控件拥有位置对于 QTabWidget 在 QWindowsStyle。要放置 QTabBar 在中心,设置选项卡栏子控件的 subcontrol-position。 The :top , :left , :right , :bottom 伪状态从属选项卡取向。 见 Customizing QTabWidget 范例。 |
QTableView |
支持
Box 模型
。当
交替行颜色
被启用,样式化交替颜色可以使用
alternate-background-color
特性。
样式化选中项的颜色和背景是使用 selection-color and selection-background-color 分别。 角落 Widget 在 QTableView 的实现如 QAbstractButton 且样式化可以使用 QTableView QTableCornerButton::section 选择器。 警告: 若仅设置 QTableCornerButton 背景颜色,背景可能不出现,除非将 border (边框) 特性设为某值。这是因为,默认情况下,QTableCornerButton 会绘制完全重叠背景色的本机边框。 栅格颜色的指定可以使用 gridline-color 特性。 见 QAbsractScrollArea 以样式化可卷动背景。 见 定制 QTableView 范例。 |
QTableWidget | 见 QTableView . |
QTextEdit |
支持
Box 模型
.
选中文本的颜色和背景的样式化是使用 selection-color and selection-background-color 分别。 见 QAbsractScrollArea 以样式化可卷动背景。 |
QTimeEdit | 见 QSpinBox . |
QToolBar |
支持
Box 模型
.
The :top , :left , :right , :bottom pseudo states depending on the area in which the tool bar is grouped. The :first , :last , :middle , :only-one pseudo states indicator the position of the tool bar within a line group (See QStyleOptionToolBar::positionWithinLine ). 分隔符对于 QToolBar 的样式化是使用 ::separator 子控件。 (移动工具栏的) 手柄的样式化是使用 ::handle 子控件。 见 定制 QToolBar 范例。 |
QToolButton |
支持
Box 模型
.
若 QToolButton 拥有菜单,是 ::menu-indicator subcontrol can be used to style the indicator. By default, the menu-indicator is positioned at the bottom right of the Padding rectangle of the widget. 若 QToolButton 是在 QToolButton::MenuButtonPopup 模式, ::menu-button subcontrol is used to draw the menu button. ::menu-arrow subcontrol is used to draw the menu arrow inside the menu-button. By default, it is positioned in the center of the Contents rectangle of the menu-button subcontrol. 当 QToolButton 显示箭头, ::up-arrow , ::down-arrow , ::left-arrow and ::right-arrow subcontrols are used. 警告: If you only set a background-color on a QToolButton , the background will not appear unless you set the border property to some value. This is because, by default, the QToolButton draws a native border which completely overlaps the background-color. For example, QToolButton { background-color: red; border: none; } 见 定制 QToolButton 范例。 |
QToolBox |
支持
Box 模型
.
The individual tabs can by styled using the ::tab subcontrol. The tabs support the :only-one , :first , :last , :middle , :previous-selected , :next-selected , :selected 伪状态。 |
QToolTip | 支持 Box 模型 。 opacity property controls the opacity of the tooltip. |
QTreeView |
支持
Box 模型
。当
交替行颜色
被启用,样式化交替颜色可以使用
alternate-background-color
特性。
样式化选中项的颜色和背景是使用 selection-color and selection-background-color 分别。 选定行为的控制是通过 show-decoration-selected 特性。 The branches of the tree view can be styled using the ::branch subcontrol. The ::branch Sub-control supports the :open , :closed , :has-sibling and :has-children 伪状态。 使用 ::item subcontrol for more fine grained control over the items in the QTreeView . 见 QAbsractScrollArea 以样式化可卷动背景。 见 定制 QTreeView for an example to style the branches. |
QTreeWidget | 见 QTreeView . |
QWidget |
仅支持
background
,
background-clip
and
background-origin
特性。
若子类来自 QWidget ,需要提供 paintEvent 为自定义 QWidget 如下: void CustomWidget::paintEvent(QPaintEvent *) { QStyleOption opt; opt.init(this); QPainter p(this); style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); } 以上代码无操作,若未设置样式表。 警告: 确保定义 Q_OBJECT 宏为自定义 Widget。 |
The table below lists all the properties supported by Qt Style Sheets. Which values can be given to an property depend on the 特性类型 . Unless otherwise specified, properties below apply to all widgets. Properties marked with an asterisk * are specific to Qt and have no equivalent in CSS2 or CSS3.
特性 | 类型 | 描述 |
---|---|---|
alternate-background-color
|
Brush |
The
替代背景颜色
用于
QAbstractItemView
子类。
若此特性未设置,将默认值设为调色板的 AlternateBase 角色。 范例: QTreeView { alternate-background-color: blue; background: yellow; } 另请参阅 background and selection-background-color . |
background
|
Background |
Shorthand notation for setting the background. Equivalent to specifying
background-color
,
background-image
,
background-repeat
, and/or
background-position
.
此特性的支持通过 QAbstractItemView 子类, QAbstractSpinBox 子类, QCheckBox , QComboBox , QDialog , QFrame , QGroupBox , QLabel , QLineEdit , QMenu , QMenuBar , QPushButton , QRadioButton , QSplitter , QTextEdit , QToolTip ,和纯 QWidget 。 范例:
QTextEdit { background: yellow }
Often, it is required to set a fill pattern similar to the styles in Qt::BrushStyle . You can use the background-color property for Qt::SolidPattern , Qt::RadialGradientPattern , Qt::LinearGradientPattern and Qt::ConicalGradientPattern . The other patterns are easily achieved by creating a background image that contains the pattern. 范例: QLabel { background-image: url(dense6pattern.png); background-repeat: repeat-xy; } 另请参阅 background-origin , selection-background-color , background-clip , background-attachment and alternate-background-color . |
background-color
|
Brush |
用于 Widget 的背景颜色。 范例: QLabel { background-color: yellow } QLineEdit { background-color: rgb(255, 0, 0) } |
background-image
|
Url |
The background image used for the widget. Semi-transparent parts of the image let the
background-color
shine through.
范例: QFrame { background-image: url(:/images/hydro.png) } |
background-repeat
|
Repeat |
Whether and how the background image is repeated to fill the
background-origin
矩形。
If this property is not specified, the background image is repeated in both directions (
范例: QFrame { background: white url(:/images/ring.png); background-repeat: repeat-y; background-position: left; } |
background-position
|
Alignment |
背景图像的对齐方式在
background-origin
矩形。
若此特性未指定,对齐方式为
范例: QFrame { background: url(:/images/footer.png); background-position: bottom left; } |
background-attachment
|
Attachment |
确定 background-image 是否在
QAbstractScrollArea
is scrolled or fixed with respect to the viewport. By default, the background-image scrolls with the viewport.
范例: QTextEdit { background-image: url("leaves.png"); background-attachment: fixed; } 另请参阅 background |
background-clip
|
Origin |
Widget 的矩形,在那里
background
被绘制。
此特性指定矩形以在那里
此特性的支持通过 QAbstractItemView 子类, QAbstractSpinBox 子类, QCheckBox , QComboBox , QDialog , QFrame , QGroupBox , QLabel , QPushButton , QRadioButton , QSplitter , QTextEdit , QToolTip ,和纯 QWidget 。
如果此特性未指定,默认为
范例: QFrame { background-image: url(:/images/header.png); background-position: top left; background-origin: content; background-clip: padding; } 另请参阅 background , background-origin and Box 模型 . |
background-origin
|
Origin |
Widget 的背景矩形,用于结合
background-position
and
background-image
.
此特性的支持通过 QAbstractItemView 子类, QAbstractSpinBox 子类, QCheckBox , QComboBox , QDialog , QFrame , QGroupBox , QLabel , QPushButton , QRadioButton , QSplitter , QTextEdit , QToolTip ,和纯 QWidget 。
如果此特性未指定,默认为
范例: QFrame { background-image: url(:/images/header.png); background-position: top left; background-origin: content; } 另请参阅 background and Box 模型 . |
border
|
Border |
Shorthand notation for setting the widget's border. Equivalent to specifying
border-color
,
border-style
, and/or
border-width
.
此特性的支持通过 QAbstractItemView 子类, QAbstractSpinBox 子类, QCheckBox , QComboBox , QFrame , QGroupBox , QLabel , QLineEdit , QMenu , QMenuBar , QPushButton , QRadioButton , QSplitter , QTextEdit , QToolTip ,和纯 QWidget 。 范例: QLineEdit { border: 1px solid white } |
border-top
|
Border |
Shorthand notation for setting the widget's top border. Equivalent to specifying
border-top-color
,
border-top-style
, and/or
border-top-width
.
|
border-right
|
Border |
Shorthand notation for setting the widget's right border. Equivalent to specifying
border-right-color
,
border-right-style
, and/or
border-right-width
.
|
border-bottom
|
Border |
Shorthand notation for setting the widget's bottom border. Equivalent to specifying
border-bottom-color
,
border-bottom-style
, and/or
border-bottom-width
.
|
border-left
|
Border |
Shorthand notation for setting the widget's left border. Equivalent to specifying
border-left-color
,
border-left-style
, and/or
border-left-width
.
|
border-color
|
Box Colors |
The color of all the border's edges. Equivalent to specifying
border-top-color
,
border-right-color
,
border-bottom-color
,和
border-left-color
.
此特性的支持通过 QAbstractItemView 子类, QAbstractSpinBox 子类, QCheckBox , QComboBox , QFrame , QGroupBox , QLabel , QLineEdit , QMenu , QMenuBar , QPushButton , QRadioButton , QSplitter , QTextEdit , QToolTip ,和纯 QWidget 。 若此特性未指定,默认为 color (i.e., the widget's foreground color). 范例: QLineEdit { border-width: 1px; border-style: solid; border-color: white; } 另请参阅 border-style , border-width , border-image ,和 Box 模型 . |
border-top-color
|
Brush | The color of the border's top edge. |
border-right-color
|
Brush | The color of the border's right edge. |
border-bottom-color
|
Brush | The color of the border's bottom edge. |
border-left-color
|
Brush | The color of the border's left edge. |
border-image
|
Border Image |
The image used to fill the border. The image is cut into nine parts and stretched appropriately if necessary. See
Border Image
了解细节。
此特性的支持通过 QAbstractItemView 子类, QAbstractSpinBox 子类, QCheckBox , QComboBox , QFrame , QGroupBox , QLabel , QLineEdit , QMenu , QMenuBar , QPushButton , QRadioButton , QSplitter , QTextEdit and QToolTip . 另请参阅 border-color , border-style , border-width ,和 Box 模型 . |
border-radius
|
Radius |
The radius of the border's corners. Equivalent to specifying
border-top-left-radius
,
border-top-right-radius
,
border-bottom-right-radius
,和
border-bottom-left-radius
.
The border-radius clips the element's background . 此特性的支持通过 QAbstractItemView 子类, QAbstractSpinBox 子类, QCheckBox , QComboBox , QFrame , QGroupBox , QLabel , QLineEdit , QMenu , QMenuBar , QPushButton , QRadioButton , QSplitter , QTextEdit ,和 QToolTip . If this property is not specified, it defaults to 0. 范例: QLineEdit { border-width: 1px; border-style: solid; border-radius: 4px; } 另请参阅 border-width and Box 模型 . |
border-top-left-radius
|
Radius | The radius of the border's top-left corner. |
border-top-right-radius
|
Radius | The radius of the border's top-right corner. |
border-bottom-right-radius
|
Radius | The radius of the border's bottom-right corner. Setting this property to a positive value results in a rounded corner. |
border-bottom-left-radius
|
Radius | The radius of the border's bottom-left corner. Setting this property to a positive value results in a rounded corner. |
border-style
|
Border Style |
所有边框边缘的样式。 此特性的支持通过 QAbstractItemView 子类, QAbstractSpinBox 子类, QCheckBox , QComboBox , QFrame , QGroupBox , QLabel , QLineEdit , QMenu , QMenuBar , QPushButton , QRadioButton , QSplitter , QTextEdit ,和 QToolTip .
若此特性未指定,默认为
范例: QLineEdit { border-width: 1px; border-style: solid; border-color: blue; } 另请参阅 border-color , border-style , border-image ,和 Box 模型 . |
border-top-style
|
Border Style | The style of the border's top edge. |
border-right-style
|
Border Style | The style of the border's right edge/ |
border-bottom-style
|
Border Style | The style of the border's bottom edge. |
border-left-style
|
Border Style | The style of the border's left edge. |
border-width
|
Box Lengths |
The width of the border. Equivalent to setting
border-top-width
,
border-right-width
,
border-bottom-width
,和
border-left-width
.
此特性的支持通过 QAbstractItemView 子类, QAbstractSpinBox 子类, QCheckBox , QComboBox , QFrame , QGroupBox , QLabel , QLineEdit , QMenu , QMenuBar , QPushButton , QRadioButton , QSplitter , QTextEdit ,和 QToolTip . 范例: QLineEdit { border-width: 2px; border-style: solid; border-color: darkblue; } 另请参阅 border-color , border-radius , border-style , border-image ,和 Box 模型 . |
border-top-width
|
长度 | The width of the border's top edge. |
border-right-width
|
长度 | The width of the border's right edge. |
border-bottom-width
|
长度 | The width of the border's bottom edge. |
border-left-width
|
长度 | The width of the border's left edge. |
bottom
|
长度 |
若
position
is
relative
(the default), moves a subcontrol by a certain offset up; specifying
bottom: y
is then equivalent to specifying
top: -y
.
若
position
is
范例: QSpinBox::down-button { bottom: 2px } |
button-layout
|
Number |
The layout of buttons in a
QDialogButtonBox
或
QMessageBox
. The possible values are 0 (
WinLayout
), 1 (
MacLayout
), 2 (
KdeLayout
), 3 (
GnomeLayout
) and 5 (
AndroidLayout
).
若此特性未指定,默认为当前样式指定值对于 SH_DialogButtonLayout 样式提示。 范例: * { button-layout: 2 } |
color
|
Brush |
颜色用于渲染文本。 This property is supported by all widgets that respect the QWidget::palette . If this property is not set, the default is whatever is set for in the widget's palette for the QWidget::foregroundRole (typically black). 范例:
QPushButton { color: red }
另请参阅 background and selection-color . |
dialogbuttonbox-buttons-have-icons
|
布尔 |
Whether the buttons in a
QDialogButtonBox
show icons
If this property is set to 1, the buttons of a QDialogButtonBox show icons; if it is set to 0, the icons are not shown. 见 图标列表 section for information on how to set icons. QDialogButtonBox { dialogbuttonbox-buttons-have-icons: 1; } 注意: Styles defining this property must be applied before the QDialogButtonBox is created; this means that you must apply the style to the parent widget or to the application itself. |
font
|
Font |
Shorthand notation for setting the text's font. Equivalent to specifying
font-family
,
font-size
,
font-style
, and/or
font-weight
.
This property is supported by all widgets that respect the QWidget::font . If this property is not set, the default is the QWidget::font . 范例: QCheckBox { font: bold italic large "Times New Roman" } |
font-family
|
字符串 |
字体系列。 范例: QCheckBox { font-family: "New Century Schoolbook" } |
font-size
|
字体大小 |
字体大小。在此版本的 Qt 中,仅支持 pt 和 px 规格。 范例: QTextEdit { font-size: 12px } |
font-style
|
字体样式 |
字体样式。 范例: QTextEdit { font-style: italic } |
font-weight
|
字体粗细 | 字体的精细。 |
gridline-color
*
|
颜色 |
栅格线的颜色在
QTableView
.
若此特性未指定,默认为当前样式指定值对于 SH_Table_GridLineColor 样式提示。 范例: * { gridline-color: gray } |
height
|
长度 |
子控件 (或在某些情况下的 Widget) 的高度。 If this property is not specified, it defaults to a value that depends on the subcontrol/widget and on the current style. 警告: Unless otherwise specified, this property has no effect when set on widgets. If you want a widget with a fixed height, set the min-height and max-height to the same value. 范例: QSpinBox::down-button { height: 10px } 另请参阅 width . |
icon-size
|
长度 |
Widget 图标的宽度和高度。 使用此特性,可以设置下列 Widget 的图标大小。 |
image
*
|
Url + |
The image that is drawn in the contents rectangle of a subcontrol.
The image property accepts a list of
Url
s or an
Setting the image property on sub controls implicitly sets the width and height of the sub-control (unless the image in a SVG). In Qt 4.3 and later, the alignment of the image within the rectangle can be specified using image-position . This property is for subcontrols only--we don't support it for other elements. 警告: The QIcon SVG plugin is needed to render SVG images. 范例: // implicitly sets the size of down-button to the // size of spindown.png QSpinBox::down-button { image: url(:/images/spindown.png) } |
image-position
|
alignment | In Qt 4.3 and later, the alignment of the image image's position can be specified using relative or absolute position. |
left
|
长度 |
若
position
is
relative
(the default), moves a subcontrol by a certain offset to the right.
若
position
is
若此特性未指定,默认为
范例: QSpinBox::down-button { left: 2px } |
lineedit-password-character*
|
Number |
The
QLineEdit
password character as a Unicode number.
若此特性未指定,默认为当前样式指定值对于 SH_LineEdit_PasswordCharacter 样式提示。 范例: * { lineedit-password-character: 9679 } |
lineedit-password-mask-delay*
|
Number |
The
QLineEdit
password mask delay in milliseconds before
lineedit-password-character
is applied to visible character.
若此特性未指定,默认为当前样式指定值对于 SH_LineEdit_PasswordMaskDelay 样式提示。 This property was added in Qt 5.4. 范例: * { lineedit-password-mask-delay: 1000 } |
margin
|
Box Lengths |
The widget's margins. Equivalent to specifying
margin-top
,
margin-right
,
margin-bottom
,和
margin-left
.
此特性的支持通过 QAbstractItemView 子类, QAbstractSpinBox 子类, QCheckBox , QComboBox , QFrame , QGroupBox , QLabel , QLineEdit , QMenu , QMenuBar , QPushButton , QRadioButton , QSplitter , QTextEdit ,和 QToolTip .
若此特性未指定,默认为
范例: QLineEdit { margin: 2px } |
margin-top
|
长度 | Widget 上边距。 |
margin-right
|
长度 | Widget 右边距。 |
margin-bottom
|
长度 | Widget 下边距。 |
margin-left
|
长度 | Widget 左边距。 |
max-height
|
长度 |
Widget 或子控件的最大高度。 此特性的支持通过 QAbstractItemView 子类, QAbstractSpinBox 子类, QCheckBox , QComboBox , QFrame , QGroupBox , QLabel , QLineEdit , QMenu , QMenuBar , QPushButton , QRadioButton , QSizeGrip , QSpinBox , QSplitter , QStatusBar , QTextEdit ,和 QToolTip . The value is relative to the contents rect in the Box 模型 . 范例: QSpinBox { max-height: 24px } 另请参阅 max-width . |
max-width
|
长度 |
Widget 或子控件的最大宽度。 此特性的支持通过 QAbstractItemView 子类, QAbstractSpinBox 子类, QCheckBox , QComboBox , QFrame , QGroupBox , QLabel , QLineEdit , QMenu , QMenuBar , QPushButton , QRadioButton , QSizeGrip , QSpinBox , QSplitter , QStatusBar , QTextEdit ,和 QToolTip . The value is relative to the contents rect in the Box 模型 . 范例: QComboBox { max-width: 72px } 另请参阅 max-height . |
messagebox-text-interaction-flags*
|
Number |
The interaction behavior for text in a message box. Possible values are based on
Qt::TextInteractionFlags
.
若此特性未指定,默认为当前样式指定值对于 SH_MessageBox_TextInteractionFlags 样式提示。 范例: QMessageBox { messagebox-text-interaction-flags: 5 } |
min-height
|
长度 |
Widget 或子控件的最小高度。 此特性的支持通过 QAbstractItemView 子类, QAbstractSpinBox 子类, QCheckBox , QComboBox , QFrame , QGroupBox , QLabel , QLineEdit , QMenu , QMenuBar , QPushButton , QRadioButton , QSizeGrip , QSpinBox , QSplitter , QStatusBar , QTextEdit ,和 QToolTip . If this property is not specified, the minimum height is derived based on the widget's contents and the style. The value is relative to the contents rect in the Box 模型 . 范例: QComboBox { min-height: 24px } 另请参阅 min-width . |
min-width
|
长度 |
Widget 或子控件的最小宽度。 此特性的支持通过 QAbstractItemView 子类, QAbstractSpinBox 子类, QCheckBox , QComboBox , QFrame , QGroupBox , QLabel , QLineEdit , QMenu , QMenuBar , QPushButton , QRadioButton , QSizeGrip , QSpinBox , QSplitter , QStatusBar , QTextEdit ,和 QToolTip . If this property is not specified, the minimum width is derived based on the widget's contents and the style. The value is relative to the contents rect in the Box 模型 . 范例: QComboBox { min-width: 72px } 另请参阅 min-height . |
opacity*
|
Number |
The opacity for a widget. Possible values are from 0 (transparent) to 255 (opaque). For the moment, this is only supported for
tooltips
.
若此特性未指定,默认为当前样式指定值对于 SH_ToolTipLabel_Opacity 样式提示。 范例: QToolTip { opacity: 223 } |
outline | 围绕对象边框绘制的轮廓。 | |
outline-color | 颜色 | 轮廓的颜色。另请参阅 border-color |
outline-offset | 长度 | 从 Widget 边框起的轮廓偏移。 |
outline-style | 指定用于绘制轮廓的模式。另请参阅 border-style | |
outline-radius | 把圆角添加到轮廓 | |
outline-bottom-left-radius | Radius | The radius for the bottom-left rounded corner of the outline. |
outline-bottom-right-radius | Radius | The radius for the bottom-right rounded corner of the outline. |
outline-top-left-radius | Radius | The radius for the top-left corner of the outline. |
outline-top-right-radius | Radius | The radius for the top-right rounded corner of the outline. |
padding
|
Box Lengths |
The widget's padding. Equivalent to specifying
padding-top
,
padding-right
,
padding-bottom
,和
padding-left
.
此特性的支持通过 QAbstractItemView 子类, QAbstractSpinBox 子类, QCheckBox , QComboBox , QFrame , QGroupBox , QLabel , QLineEdit , QMenu , QMenuBar , QPushButton , QRadioButton , QSplitter , QTextEdit ,和 QToolTip .
若此特性未指定,默认为
范例: QLineEdit { padding: 3px } |
padding-top
|
长度 | Widget 的顶部铺垫。 |
padding-right
|
长度 | Widget 的右侧铺垫。 |
padding-bottom
|
长度 | Widget 的底部铺垫。 |
padding-left
|
长度 | Widget 的左侧铺垫。 |
paint-alternating-row-colors-for-empty-area
|
bool
|
是否 QTreeView 描绘用于空区域 (即:不存在项的区域) 的交替行颜色 |
位置
|
relative
|
absolute
|
是否偏移指定使用
left
,
right
,
top
,和
bottom
是相对 (或绝对) 坐标。
若此特性未指定,默认为
|
right
|
长度 |
若
position
is
relative
(the default), moves a subcontrol by a certain offset to the left; specifying
right: x
is then equivalent to specifying
left: -x
.
若
position
is
范例: QSpinBox::down-button { right: 2px } |
selection-background-color*
|
Brush |
选中文本 (或项) 的背景。 This property is supported by all widgets that respect the QWidget::palette and that show selection text. 若此特性未设置,将默认值设为调色板的 Highlight 角色。 范例: QTextEdit { selection-background-color: darkblue } 另请参阅 selection-color and background . |
selection-color*
|
Brush |
选中文本 (或项) 的前景。 This property is supported by all widgets that respect the QWidget::palette and that show selection text. 若此特性未设置,将默认值设为调色板的 HighlightedText 角色。 范例: QTextEdit { selection-color: white } 另请参阅 selection-background-color and color . |
show-decoration-selected*
|
布尔 |
Controls whether selections in a
QListView
cover the entire row or just the extent of the text.
若此特性未指定,默认为当前样式指定值对于 SH_ItemView_ShowDecorationSelected 样式提示。 范例: * { show-decoration-selected: 1 } |
spacing*
|
长度 |
Internal spacing in the widget. 此特性的支持通过 QCheckBox , checkable QGroupBox es, QMenuBar ,和 QRadioButton . If this property is not specified, the default value depends on the widget and on the current style. 范例: QMenuBar { spacing: 10 } |
subcontrol-origin*
|
Origin |
The origin rectangle of the subcontrol within the parent element.
如果此特性未指定,默认为
范例: QSpinBox::up-button { image: url(:/images/spinup.png); subcontrol-origin: content; subcontrol-position: right top; } 另请参阅 subcontrol-position . |
subcontrol-position*
|
Alignment |
The alignment of the subcontrol within the origin rectangle specified by
subcontrol-origin
.
If this property is not specified, it defaults to a value that depends on the subcontrol. 范例: QSpinBox::down-button { image: url(:/images/spindown.png); subcontrol-origin: padding; subcontrol-position: right bottom; } 另请参阅 subcontrol-origin . |
titlebar-show-tooltips-on-buttons
}
|
bool
|
Whether tool tips are shown on window title bar buttons. |
widget-animation-duration*
|
Number |
How much an animation should last (in milliseconds). A value equal to zero means that the animations will be disabled. 若此特性未指定,默认为当前样式指定值对于 SH_Widget_Animation_Duration 样式提示。 该特性在 Qt 5.10 添加。 范例: * { widget-animation-duration: 100 } |
text-align
|
Alignment |
The alignment of text and icon within the contents of the widget. If this value is not specified, it defaults to the value that depends on the native style. 范例: QPushButton { text-align: left; } 此特性目前仅支持通过 QPushButton and QProgressBar . |
text-decoration
|
none
underline
overline
line-through
|
额外文本效果 |
top
|
长度 |
若
position
is
relative
(the default), moves a subcontrol by a certain offset down.
若
position
is
若此特性未指定,默认为
范例: QSpinBox::up-button { top: 2px } |
width
|
长度 |
The width of a subcontrol (or a widget in some cases). If this property is not specified, it defaults to a value that depends on the subcontrol/widget and on the current style. 警告: Unless otherwise specified, this property has no effect when set on widgets. If you want a widget with a fixed width, set the min-width and max-width to the same value. 范例: QSpinBox::up-button { width: 12px } 另请参阅 height . |
Icons used in Qt can be customized using the following properties. Each of the properties listed in this section have the type 图标 .
Note that for icons to appear in buttons in a QDialogButtonBox , you need to set the dialogbuttonbox-buttons-have-icons property to true. Also, to customize the size of the icons, use the icon-size property.
下表汇总了不同特性类型的句法和含义。
类型 | 句法 | 描述 |
---|---|---|
Alignment |
{
top
|
bottom
|
left
|
right
|
center
}*
|
水平和/或垂直对齐。 范例: QTextEdit { background-position: bottom center } |
Attachment |
{
scroll
|
fixed
}*
|
卷动或固定附件。 |
Background |
{
Brush
| Url | Repeat | Alignment }* |
A sequence of Brush , Url , Repeat ,和 Alignment . |
布尔 | 0 | 1 |
True (
1
) or false (
0
).
范例: QDialog { etch-disabled-text: 1 } |
Border |
{
Border Style
| 长度 | Brush }* |
Shorthand border property. |
Border Image |
none
| Url Number {4} (
stretch
|
repeat
){0,2}
|
A border image is an image that is composed of nine parts (top left, top center, top right, center left, center, center right, bottom left, bottom center, and bottom right). When a border of a certain size is required, the corner parts are used as is, and the top, right, bottom, and left parts are stretched or repeated to produce a border with the desired size. 见 CSS3 Draft Specification 了解细节。 |
Border Style |
dashed
|
dot-dash
|
dot-dot-dash
|
dotted
|
double
|
groove
|
inset
|
outset
|
ridge
|
solid
|
none
|
Specifies the pattern used to draw a border. See the CSS3 Draft Specification 了解细节。 |
Box Colors | Brush {1,4} |
One to four occurrences of
Brush
, specifying the top, right, bottom, and left edges of a box, respectively. If the left color is not specified, it is taken to be the same as the right color. If the bottom color is not specified, it is taken to be the same as the top color. If the right color is not specified, it is taken to be the same as the top color.
范例: QLabel { border-color: red } /* red red red red */ QLabel { border-color: red blue } /* red blue red blue */ QLabel { border-color: red blue green } /* red blue green blue */ QLabel { border-color: red blue green yellow } /* red blue green yellow */ |
Box Lengths | 长度 {1,4} |
One to four occurrences of
长度
, specifying the top, right, bottom, and left edges of a box, respectively. If the left length is not specified, it is taken to be the same as the right length. If the bottom length is not specified, is it taken to be the same as the top length. If the right length is not specified, it is taken to be the same as the top length.
范例: QLabel { border-width: 1px } /* 1px 1px 1px 1px */ QLabel { border-width: 1px 2px } /* 1px 2px 1px 2px */ QLabel { border-width: 1px 2px 3px } /* 1px 2px 3px 2px */ QLabel { border-width: 1px 2px 3px 4px } /* 1px 2px 3px 4px */ |
Brush |
颜色
| Gradient | PaletteRole |
Specifies a Color or a Gradient or an entry in the Palette. |
颜色 |
rgb(r, g, b)
|
rgba(r, g, b, a)
|
hsv(h, s, v)
|
hsva(h, s, v, a)
|
#rrggbb
| Color Name |
Specifies a color as RGB (red, green, blue) or RGBA (red, green, blue, alpha) or HSV (hue, saturation, value) or HSVA (hue, saturation, value, alpha) or a named color. The
rgb()
or
rgba()
syntax can be used with integer values between 0 and 255, or with percentages. The value of s, v, and a in
hsv()
or
hsva()
must all be in the range 0-255; the value of h must be in the range 0-359.
范例: QLabel { border-color: red } /* opaque red */ QLabel { border-color: #FF0000 } /* opaque red */ QLabel { border-color: rgba(255, 0, 0, 75%) } /* 75% opaque red */ QLabel { border-color: rgb(255, 0, 0) } /* opaque red */ QLabel { border-color: rgb(100%, 0%, 0%) } /* opaque red */ QLabel { border-color: hsv(60, 255, 255) } /* opaque yellow */ QLabel { border-color: hsva(240, 255, 255, 75%) } /* 75% blue */ 注意: The RGB colors allowed are the same as those allowed with CSS 2.1, as listed here . |
Font | ( 字体样式 | 字体粗细 ){0,2} 字体大小 字符串 | Shorthand font property. |
字体大小 | 长度 | 字体大小。 |
字体样式 |
normal
|
italic
|
oblique
|
字体样式。 |
字体粗细 |
normal
|
bold
|
100
|
200
... |
900
|
字体的粗细。 |
Gradient |
qlineargradient
|
qradialgradient
|
qconicalgradient
|
Specifies gradient fills. There are three types of gradient fills:
Gradients are specified in Object Bounding Mode. Imagine the box in which the gradient is rendered, to have its top left corner at (0, 0) and its bottom right corner at (1, 1). Gradient parameters are then specified as percentages from 0 to 1. These values are extrapolated to actual box coordinates at runtime. It is possible specify values that lie outside the bounding box (-0.6 or 1.8, for instance). 警告: The stops have to appear sorted in ascending order. 范例: /* linear gradient from white to green */ QTextEdit { background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 white, stop: 0.4 gray, stop:1 green) } /* linear gradient from white to green */ QTextEdit { background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 white, stop: 0.4 rgba(10, 20, 30, 40), stop:1 rgb(0, 200, 230, 200)) } /* conical gradient from white to green */ QTextEdit { background: qconicalgradient(cx:0.5, cy:0.5, angle:30, stop:0 white, stop:1 #00FF00) } /* radial gradient from white to green */ QTextEdit { background: qradialgradient(cx:0, cy:0, radius: 1, fx:0.5, fy:0.5, stop:0 white, stop:1 green) } |
图标 |
(
Url
(
被禁用
|
active
|
normal
|
selected
)? (
on
|
off
)? )*
|
A list of url,
QIcon::Mode
and
QIcon::State
.
范例: * { file-icon: url(file.png), url(file_selected.png) selected; } QMessageBox { dialogbuttonbox-buttons-have-icons: true; dialog-ok-icon: url(ok.svg); dialog-cancel-icon: url(cancel.png), url(grayed_cancel.png) disabled; } |
长度 |
Number
(
px
|
pt
|
em
|
ex
)?
|
A number followed by a measurement unit. The CSS standard recommends that user agents must
ignore
a declaration with an illegal value. In Qt, it is mandatory to specify measurement units. For compatibility with earlier versions of Qt, numbers without measurement units are treated as pixels in most contexts. The supported units are:
However, Qt is limited to font sizes in
|
Number | A decimal integer or a real number |
范例:
0
,
18
,
+127
,
-255
,
12.34
,
-.5
,
0009
.
|
Origin |
margin
|
border
|
padding
|
content
|
Indicates which of four rectangles to use.
另请参阅 Box 模型 . |
PaletteRole |
alternate-base
|
base
|
bright-text
|
button
|
button-text
|
dark
|
highlight
|
highlighted-text
|
light
|
link
|
link-visited
|
mid
|
midlight
|
shadow
|
text
|
window
|
window-text
|
These values correspond the
Color roles
in the widget's
QPalette
.
例如,
QPushButton { color: palette(dark); }
|
Radius | 长度 {1, 2} | One or two occurrences of 长度 . If only one length is specified, it is used as the radius of the quarter circle defining the corner. If two lengths are specified, the first length is the horizontal radius of a quarter ellipse, whereas the second length is the vertical radius. |
Repeat |
repeat-x
|
repeat-y
|
repeat
|
no-repeat
|
A value indicating the nature of repetition.
|
Url |
url(filename)
|
filename
is the name of a file on the local disk or stored using
Qt 资源系统
. Setting an image implicitly sets the width and height of the element.
|
支持下列伪状态:
伪状态 | 描述 |
---|---|
:active
|
此状态被设置,当 Widget 在活动窗口中时。 |
:adjoins-item
|
This state is set when the ::branch 的 QTreeView is adjacent to an item. |
:alternate
|
This state is set for every alternate row whe painting the row of a QAbstractItemView 当 QAbstractItemView::alternatingRowColors () is set to true. |
:bottom
|
The item is positioned at the bottom. For example, a QTabBar that has its tabs positioned at the bottom. |
:checked
|
The item is checked. For example, the checked state of QAbstractButton . |
:closable
|
The items can be closed. For example, the QDockWidget 拥有 QDockWidget::DockWidgetClosable feature turned on. |
:closed
|
The item is in the closed state. For example, an non-expanded item in a QTreeView |
:default
|
The item is the default. For example, a default QPushButton or a default action in a QMenu . |
:disabled
|
项是 被禁用 . |
:editable
|
The QComboBox 是可编辑的。 |
:edit-focus
|
The item has edit focus (See QStyle::State_HasEditFocus ). This state is available only for Qt Extended applications. |
:enabled
|
项是 enabled . |
:exclusive
|
The item is part of an exclusive item group. For example, a menu item in a exclusive QActionGroup . |
:first
|
The item is the first (in a list). For example, the first tab in a QTabBar . |
:flat
|
项是扁平的。例如, flat QPushButton . |
:floatable
|
The items can be floated. For example, the QDockWidget 拥有 QDockWidget::DockWidgetFloatable feature turned on. |
:focus
|
项有 输入聚焦 . |
:has-children
|
The item has children. For example, an item in a QTreeView that has child items. |
:has-siblings
|
The item has siblings. For example, an item in a QTreeView that siblings. |
:horizontal
|
The item has horizontal orientation |
:hover
|
The mouse is hovering over the item. |
:indeterminate
|
The item has indeterminate state. For example, a QCheckBox or QRadioButton is partially checked . |
:last
|
The item is the last (in a list). For example, the last tab in a QTabBar . |
:left
|
The item is positioned at the left. For example, a QTabBar that has its tabs positioned at the left. |
:maximized
|
The item is maximized. For example, a maximized QMdiSubWindow . |
:middle
|
The item is in the middle (in a list). For example, a tab that is not in the beginning or the end in a QTabBar . |
:minimized
|
The item is minimized. For example, a minimized QMdiSubWindow . |
:movable
|
The item can be moved around. For example, the QDockWidget 拥有 QDockWidget::DockWidgetMovable feature turned on. |
:no-frame
|
The item has no frame. For example, a frameless QSpinBox or QLineEdit . |
:non-exclusive
|
The item is part of a non-exclusive item group. For example, a menu item in a non-exclusive QActionGroup . |
:off
|
For items that can be toggled, this applies to items in the "off" state. |
:on
|
For items that can be toggled, this applies to widgets in the "on" state. |
:only-one
|
The item is the only one (in a list). For example, a lone tab in a QTabBar . |
:open
|
The item is in the open state. For example, an expanded item in a QTreeView ,或 QComboBox or QPushButton with an open menu. |
:next-selected
|
The next item (in a list) is selected. For example, the selected tab of a QTabBar is next to this item. |
:pressed
|
The item is being pressed using the mouse. |
:previous-selected
|
The previous item (in a list) is selected. For example, a tab in a QTabBar that is next to the selected tab. |
:read-only
|
The item is marked read only or non-editable. For example, a read only QLineEdit or a non-editable QComboBox . |
:right
|
The item is positioned at the right. For example, a QTabBar that has its tabs positioned at the right. |
:selected
|
The item is selected. For example, the selected tab in a QTabBar or the selected item in a QMenu . |
:top
|
The item is positioned at the top. For example, a QTabBar that has its tabs positioned at the top. |
:unchecked
|
项是 unchecked . |
:vertical
|
项有垂直取向。 |
:window
|
The widget is a window (i.e top level widget) |
下列子控件可用:
Sub-Control | 描述 |
---|---|
::add-line
|
The button to add a line of a QScrollBar . |
::add-page
|
The region between the handle (slider) and the add-line 的 QScrollBar . |
::branch
|
The branch indicator of a QTreeView . |
::chunk
|
The progress chunk of a QProgressBar . |
::close-button
|
The close button of a QDockWidget or tabs of QTabBar |
::corner
|
The corner between two scrollbars in a QAbstractScrollArea |
::down-arrow
|
The down arrow of a QComboBox , QHeaderView (sort indicator), QScrollBar or QSpinBox . |
::down-button
|
The down button of a QScrollBar 或 QSpinBox . |
::drop-down
|
The drop-down button of a QComboBox . |
::float-button
|
浮动按钮对于 QDockWidget |
::groove
|
凹槽对于 QSlider . |
::indicator
|
指示器对于 QAbstractItemView , QCheckBox , QRadioButton ,可复选 QMenu item or a checkable QGroupBox . |
::handle
|
The handle (slider) of a QScrollBar , QSplitter ,或 QSlider . |
::icon
|
The icon of a QAbstractItemView 或 QMenu . |
::item
|
项对于 QAbstractItemView , QMenuBar , QMenu ,或 QStatusBar . |
::left-arrow
|
The left arrow of a QScrollBar . |
::left-corner
|
The left corner of a QTabWidget . For example, this control can be used to control position the left corner widget in a QTabWidget . |
::menu-arrow
|
The arrow of a QToolButton with a menu. |
::menu-button
|
The menu button of a QToolButton . |
::menu-indicator
|
The menu indicator of a QPushButton . |
::right-arrow
|
The right arrow of a QMenu 或 QScrollBar . |
::pane
|
窗格 (框架) 对于 QTabWidget . |
::right-corner
|
The right corner of a QTabWidget . For example, this control can be used to control the position the right corner widget in a QTabWidget . |
::scroller
|
The scroller of a QMenu or QTabBar . |
::section
|
The section of a QHeaderView . |
::separator
|
分隔符对于 QMenu 或在 QMainWindow . |
::sub-line
|
The button to subtract a line of a QScrollBar . |
::sub-page
|
The region between the handle (slider) and the sub-line 的 QScrollBar . |
::tab
|
选项卡对于 QTabBar or QToolBox . |
::tab-bar
|
选项卡栏对于 QTabWidget 。此子控件的存在仅用于控制位置对于 QTabBar 在 QTabWidget 。要样式选项卡使用 ::tab 子控件。 |
::tear
|
撕裂指示器对于 QTabBar . |
::tearoff
|
The tear-off indicator of a QMenu . |
::text
|
The text of a QAbstractItemView . |
::title
|
The title of a QGroupBox 或 QDockWidget . |
::up-arrow
|
The up arrow of a QHeaderView (sort indicator), QScrollBar 或 QSpinBox . |
::up-button
|
The up button of a QSpinBox . |
见 定制 QPushButton 的菜单指示器子控件 有关如何定制子控件的范例。