Warning
This section contains snippets that were automatically translated from C++ to Python and may contain errors.
Qt Style Sheets Reference#
List of Stylable Widgets#
The following table lists the Qt widgets that can be customized using style sheets:
Widget
How to Style
QAbstractScrollArea.. _qabstractscrollarea-widget:Supports the box model .
All derivatives of
QAbstractScrollArea, includingQTextEdit, andQAbstractItemView(all item view classes), support scrollable backgrounds using background-attachment . Setting the background-attachment tofixedprovides a background-image that does not scroll with the viewport. Setting the background-attachment toscroll, scrolls the background-image when the scroll bars move.See Customizing QAbstractScrollArea for an example.
QCheckBox.. _qcheckbox-widget:Supports the box model . The check indicator can be styled using the ::indicator subcontrol. By default, the indicator is placed in the Top Left corner of the Contents rectangle of the widget.
The spacing property specifies the spacing between the check indicator and the text.
See Customizing QCheckBox for an example.
QColumnView.. _qcolumnview-widget:The grip can be styled be using the image property. The arrow indicators can by styled using the ::left-arrow subcontrol and the ::right-arrow subcontrol.
QComboBox.. _qcombobox-widget:The frame around the combobox can be styled using the box model . 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.
The color of the placeholder text can be set using the placeholder-text-color property.
See Customizing QComboBox for an example.
QDateEdit.. _qdateedit-widget:See QSpinBox .
QDateTimeEdit.. _qdatetimeedit-widget:See QSpinBox .
QDialog.. _qdialog-widget:Supports only the background , background-clip and background-origin properties.
Warning
Make sure you define the
Q_OBJECTmacro for your custom widget.
QDialogButtonBox.. _qdialogbuttonbox-widget:The layout of buttons can be altered using the button-layout property.
QDockWidget.. _qdockwidget-widget: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 respectively.
When the title bar is vertical, the :vertical pseudo class is set. In addition, depending on
DockWidgetFeature, the :closable , :floatable and :movable pseudo states are set.Note
Use QMainWindow::separator to style the resize handle.
Warning
The style sheet has no effect when the
QDockWidgetis undocked as Qt uses native top level windows when undocked.See Customizing QDockWidget for an example.
QDoubleSpinBox.. _qdoublespinbox-widget:See QSpinBox .
QFrame.. _qframe-widget:Supports the box model .
Since 4.3, setting a stylesheet on a
QLabelautomatically sets theframeStyleproperty toStyledPanel.See Customizing QFrame for an example.
QGroupBox.. _qgroupbox-widget:Supports the box model . 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 subcontrol. The spacing property can be used to control the spacing between the text and indicator.See Customizing QGroupBox for an example.
QHeaderView.. _qheaderview-widget:Supports the box model . The sections of the header view are styled using the ::section sub control. The
sectionSub-control supports the :middle , :first , :last , :only-one , :next-selected , :previous-selected , :selected , and :checked pseudo states.The sort indicator can be styled using the ::up-arrow and the ::down-arrow Sub-control.
See Customizing QHeaderView for an example.
QLabel.. _qlabel-widget:Supports the box model . Does not support the :hover pseudo-state.
Since 4.3, setting a stylesheet on a
QLabelautomatically sets theframeStyleproperty toStyledPanel.See Customizing QFrame for an example (a
QLabelderives fromQFrame).
QLineEdit.. _qlineedit-widget:Supports the box model .
The color and background of the selected item is styled using selection-color and selection-background-color respectively.
The color of the placeholder text can be set using the placeholder-text-color property.
The password character can be styled using the lineedit-password-character property.
The password mask delay can be changed using the lineedit-password-mask-delay
See Customizing QLineEdit for an example.
QListView.. _qlistview-widget:Supports the box model . When
alternating row colorsis enabled, the alternating colors can be styled using the alternate-background-color property.The color and background of the selected item is styled using selection-color and selection-background-color respectively.
The selection behavior is controlled by the show-decoration-selected property.
Use the ::item subcontrol for more fine grained control over the items in the
QListView.See QAbsractScrollArea to style scrollable backgrounds.
See Customzing QListView for an example.
QListWidget.. _qlistwidget-widget:See QListView .
QMainWindow.. _qmainwindow-widget:Supports styling of the separator
The separator in a
QMainWindowwhen usingQDockWidgetis styled using the ::separator subcontrol.See Customizing QMainWindow for an example.
QMenu.. _qmenu-widget:Supports the box model .
Individual items are styled using the ::item subcontrol. In addition to the usually supported pseudo states,
itemsubcontrol supports the :selected , :default , :exclusive and the non-exclusive pseudo states.The indicator of checkable menu items is styled using the ::indicator subcontrol.
The separator is styled using the ::separator subcontrol.
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 .
See Customizing QMenu for an example.
QMenuBar.. _qmenubar-widget:Supports the box model . The spacing property specifies the spacing between menu items. Individual items are styled using the ::item subcontrol.
Warning
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.
See Customizing QMenuBar for an example.
QMessageBox.. _qmessagebox-widget:The messagebox-text-interaction-flags property can be used to alter the interaction with text in the message box.
QProgressBar.. _qprogressbar-widget:Supports the box model . 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 progress bars have the :indeterminate pseudo state set.
See Customizing QProgressBar for an example.
QPushButton.. _qpushbutton-widget:Supports the box model . Supports the :default , :flat , :checked pseudo states.
Since 5.15, the icon property can be set to override the button icon.
For
QPushButtonwith 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.Warning
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, theQPushButtondraws a native border which completely overlaps the background-color. For example,QPushButton { background-color: red; border: none; }See Customizing QPushButton for an example.
QRadioButton.. _qradiobutton-widget:Supports the box model . The check indicator can be styled using the ::indicator subcontrol. By default, the indicator is placed in the Top Left corner of the Contents rectangle of the widget.
The spacing property specifies the spacing between the check indicator and the text.
See Customizing QRadioButton for an example.
QScrollBar.. _qscrollbar-widget:Supports the box model . 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 and the :vertical pseudo states.The slider can be styled using the ::handle subcontrol. Setting the min-width or min-height provides size constraints 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.
See Customizing QScrollBar for an example.
QSizeGrip.. _qsizegrip-widget:Supports the width , height , and image properties.
See Customizing QSizeGrip for an example.
QSlider.. _qslider-widget:Supports the box model . For horizontal slides, the min-width and height properties must be provided. For vertical sliders, the min-height and width properties must be provided.
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.
See Customizing QSlider for an example.
QSpinBox.. _qspinbox-widget:The frame of the spin box can be styled using the box model .
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.
See Customizing QSpinBox for an example.
QSplitter.. _qsplitter-widget:Supports the box model . The handle of the splitter is styled using the ::handle subcontrol.
See Customizing QSplitter for an example.
QStatusBar.. _qstatusbar-widget:Supports only the background property. The frame for individual items can be style using the ::item subcontrol.
See Customizing QStatusBar for an example.
QTabBar.. _qtabbar-widget:Individual tabs may be styled using the ::tab subcontrol. Close buttons using the ::close-button The tabs support the :only-one , :first , :last , :middle , :previous–selected , :next-selected , :selected pseudo states.
The :top , :left , :right , :bottom pseudo states depending on the orientation of the tabs.
Overlapping tabs for the selected state are created by using negative margins or using the
absoluteposition scheme.The tear indicator of the
QTabBaris styled using the ::tear subcontrol.
QTabBarused two QToolButtons for its scrollers that can be styled using theQTabBar QToolButtonselector. To specify the width of the scroll button use the ::scroller subcontrol.The alignment of the tabs within the
QTabBaris styled using the alignment property.To change the position of the
QTabBarwithin aQTabWidget, use the tab-bar subcontrol (and set subcontrol-position).See Customizing QTabBar for an example.
QTabWidget.. _qtabwidget-widget:The frame of the tab widget is styled using the ::pane subcontrol. The left and right corners are styled using the ::left-corner and ::right-corner respectively. The position of the tab bar is controlled using the ::tab-bar subcontrol.
By default, the subcontrols have positions of a
QTabWidgetin the QWindowsStyle. To place theQTabBarin the center, set the subcontrol-position of the tab-bar subcontrol.The :top , :left , :right , :bottom pseudo states depending on the orientation of the tabs.
See Customizing QTabWidget for an example.
QTableView.. _qtableview-widget:Supports the box model . When
alternating row colorsis enabled, the alternating colors can be styled using the alternate-background-color property.The color and background of the selected item is styled using selection-color and selection-background-color respectively.
The corner widget in a
QTableViewis implemented as aQAbstractButtonand can be styled using the “QTableViewQTableCornerButton::section” selector.Warning
If you only set a background-color on a QTableCornerButton, the background may not appear unless you set the border property to some value. This is because, by default, the QTableCornerButton draws a native border which completely overlaps the background-color.
The color of the grid can be specified using the gridline-color property.
See QAbsractScrollArea to style scrollable backgrounds.
See Customzing QTableView for an example.
QTableWidget.. _qtablewidget-widget:See QTableView .
QTextEdit.. _qtextedit-widget:Supports the box model .
The color and background of selected text is styled using selection-color and selection-background-color respectively.
The color of the placeholder text can be set using the placeholder-text-color property.
See QAbsractScrollArea to style scrollable backgrounds.
QTimeEdit.. _qtimeedit-widget:See QSpinBox .
QToolBar.. _qtoolbar-widget:Supports the box model .
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 ).
The separator of a
QToolBaris styled using the ::separator subcontrol.The handle (to move the toolbar) is styled using the ::handle subcontrol.
See Customizing QToolBar for an example.
QToolButton.. _qtoolbutton-widget:Supports the box model .
If the
QToolButtonhas a menu, is ::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.If the
QToolButtonis inMenuButtonPopupmode, the ::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.When the
QToolButtondisplays arrows, the ::up-arrow , ::down-arrow , ::left-arrow and ::right-arrow subcontrols are used.Warning
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, theQToolButtondraws a native border which completely overlaps the background-color. For example,QToolButton { background-color: red; border: none; }See Customizing QToolButton for an example.
QToolBox.. _qtoolbox-widget:Supports the box model .
The individual tabs can by styled using the ::tab subcontrol. The tabs support the :only-one , :first , :last , :middle , :previous-selected , :next-selected , :selected pseudo states.
QToolTip.. _qtooltip-widget:Supports the box model . The opacity property controls the opacity of the tooltip.
See Customizing QFrame for an example (a
QToolTipis aQFrame).
QTreeView.. _qtreeview-widget:Supports the box model . When
alternating row colorsis enabled, the alternating colors can be styled using the alternate-background-color property.The color and background of the selected item is styled using selection-color and selection-background-color respectively.
The selection behavior is controlled by the show-decoration-selected property.
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 pseudo states.
Use the ::item subcontrol for more fine grained control over the items in the
QTreeView.See QAbsractScrollArea to style scrollable backgrounds.
See Customizing QTreeView for an example to style the branches.
QTreeWidget.. _qtreewidget-widget:See QTreeView .
QWidget.. _qwidget-widget:Supports only the background , background-clip and background-origin properties.
If you subclass from
QWidget, you need to provide a paintEvent for your customQWidgetas below:def paintEvent(self, arg__0): opt = QStyleOption() opt.initFrom(self) p = QPainter(self) style().drawPrimitive(QStyle.PE_Widget, opt, p, self)The above code is a no-operation if there is no stylesheet set.
Warning
Make sure you define the
Q_OBJECTmacro for your custom widget.
List of Properties#
The table below lists all the properties supported by Qt Style Sheets. Which values can be given to an property depend on the property’s type . 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.
Property
Type
Description
alternate-background-color .. _alternate-background-color-prop:
The
alternate background colorused inQAbstractItemViewsubclasses.If this property is not set, the default value is whatever is set for the palette’s
AlternateBaserole.Example:
QTreeView { alternate-background-color: blue; background: yellow; }See also background and selection-background-color .
background .. _background-prop:
Shorthand notation for setting the background. Equivalent to specifying
background-color,background-image,background-repeat, and/orbackground-position.This property is supported by
QAbstractItemViewsubclasses,QAbstractSpinBoxsubclasses,QCheckBox,QComboBox,QDialog,QFrame,QGroupBox,QLabel,QLineEdit,QMenu,QMenuBar,QPushButton,QRadioButton,QSplitter,QTextEdit,QToolTip, and plainQWidgets.Example:
QTextEdit { background: yellow }Often, it is required to set a fill pattern similar to the styles in
BrushStyle. You can use the background-color property forSolidPattern,RadialGradientPattern,LinearGradientPatternandConicalGradientPattern. The other patterns are easily achieved by creating a background image that contains the pattern.Example:
QLabel { background-image: url(dense6pattern.png); background-repeat: repeat-xy; }See also background-origin , selection-background-color , background-clip , background-attachment and alternate-background-color .
background-color.. _background-color-prop:The background color used for the widget.
Examples:
QLabel { background-color: yellow } QLineEdit { background-color: rgb(255, 0, 0) }
background-image.. _background-image-prop:The background image used for the widget. Semi-transparent parts of the image let the
background-colorshine through.Example:
QFrame { background-image: url(:/images/hydro.png) }
background-repeat.. _background-repeat-prop:Whether and how the background image is repeated to fill the
background-originrectangle.If this property is not specified, the background image is repeated in both directions (
repeat).Example:
QFrame { background: white url(:/images/ring.png); background-repeat: repeat-y; background-position: left; }
background-positionThe alignment of the background image within the
background-originrectangle.If this property is not specified, the alignment is
topleft.Example:
QFrame { background: url(:/images/footer.png); background-position: bottom left; }background-attachment .. _background-attachment-prop:
Determines whether the background-image in a
QAbstractScrollAreais scrolled or fixed with respect to the viewport. By default, the background-image scrolls with the viewport.Example:
QTextEdit { background-image: url("leaves.png"); background-attachment: fixed; }See also background
background-clip .. _background-clip-prop:
The widget’s rectangle, in which the
backgroundis drawn.This property specifies the rectangle to which the
background-colorandbackground-imageare clipped.This property is supported by
QAbstractItemViewsubclasses,QAbstractSpinBoxsubclasses,QCheckBox,QComboBox,QDialog,QFrame,QGroupBox,QLabel,QPushButton,QRadioButton,QSplitter,QTextEdit,QToolTip, and plainQWidgets.If this property is not specified, the default is
border.Example:
QFrame { background-image: url(:/images/header.png); background-position: top left; background-origin: content; background-clip: padding; }See also background , background-origin and The Box Model .
background-origin .. _background-origin-prop:
The widget’s background rectangle, to use in conjunction with
background-positionandbackground-image.This property is supported by
QAbstractItemViewsubclasses,QAbstractSpinBoxsubclasses,QCheckBox,QComboBox,QDialog,QFrame,QGroupBox,QLabel,QPushButton,QRadioButton,QSplitter,QTextEdit,QToolTip, and plainQWidgets.If this property is not specified, the default is
padding.Example:
QFrame { background-image: url(:/images/header.png); background-position: top left; background-origin: content; }See also background and The Box Model .
border .. _border-prop:
Shorthand notation for setting the widget’s border. Equivalent to specifying
border-color,border-style, and/orborder-width.This property is supported by
QAbstractItemViewsubclasses,QAbstractSpinBoxsubclasses,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit,QMenu,QMenuBar,QPushButton,QRadioButton,QSplitter,QTextEdit,QToolTip, and plainQWidgets.Example:
QLineEdit { border: 1px solid white }
border-topShorthand notation for setting the widget’s top border. Equivalent to specifying
border-top-color,border-top-style, and/orborder-top-width.
border-rightShorthand notation for setting the widget’s right border. Equivalent to specifying
border-right-color,border-right-style, and/orborder-right-width.
border-bottomShorthand notation for setting the widget’s bottom border. Equivalent to specifying
border-bottom-color,border-bottom-style, and/orborder-bottom-width.
border-leftShorthand notation for setting the widget’s left border. Equivalent to specifying
border-left-color,border-left-style, and/orborder-left-width.border-color .. _border-attrs: .. _border-color-prop:
The color of all the border’s edges. Equivalent to specifying
border-top-color,border-right-color,border-bottom-color, andborder-left-color.This property is supported by
QAbstractItemViewsubclasses,QAbstractSpinBoxsubclasses,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit,QMenu,QMenuBar,QPushButton,QRadioButton,QSplitter,QTextEdit,QToolTip, and plainQWidgets.If this property is not specified, it defaults to color (i.e., the widget’s foreground color).
Example:
QLineEdit { border-width: 1px; border-style: solid; border-color: white; }See also border-style , border-width , border-image , and The Box Model .
border-top-colorThe color of the border’s top edge.
border-right-colorThe color of the border’s right edge.
border-bottom-colorThe color of the border’s bottom edge.
border-left-colorThe color of the border’s left edge.
border-image .. _border-image-prop:
The image used to fill the border. The image is cut into nine parts and stretched appropriately if necessary. See Border Image for details.
This property is supported by
QAbstractItemViewsubclasses,QAbstractSpinBoxsubclasses,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit,QMenu,QMenuBar,QPushButton,QRadioButton,QSplitter,QTextEditandQToolTip.See also border-color , border-style , border-width , and The Box Model .
border-radius .. _border-radius-prop:
The radius of the border’s corners. Equivalent to specifying
border-top-left-radius,border-top-right-radius,border-bottom-right-radius, andborder-bottom-left-radius.The border-radius clips the element’s background .
This property is supported by
QAbstractItemViewsubclasses,QAbstractSpinBoxsubclasses,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit,QMenu,QMenuBar,QPushButton,QRadioButton,QSplitter,QTextEdit, andQToolTip.If this property is not specified, it defaults to 0.
Example:
QLineEdit { border-width: 1px; border-style: solid; border-radius: 4px; }See also border-width and The Box Model .
border-top-left-radiusThe radius of the border’s top-left corner.
border-top-right-radiusThe radius of the border’s top-right corner.
border-bottom-right-radiusThe radius of the border’s bottom-right corner. Setting this property to a positive value results in a rounded corner.
border-bottom-left-radiusThe radius of the border’s bottom-left corner. Setting this property to a positive value results in a rounded corner.
border-style .. _border-style-prop:
The style of all the border’s edges.
This property is supported by
QAbstractItemViewsubclasses,QAbstractSpinBoxsubclasses,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit,QMenu,QMenuBar,QPushButton,QRadioButton,QSplitter,QTextEdit, andQToolTip.If this property is not specified, it defaults to
none.Example:
QLineEdit { border-width: 1px; border-style: solid; border-color: blue; }See also border-color , border-style , border-image , and The Box Model .
border-top-styleThe style of the border’s top edge.
border-right-styleThe style of the border’s right edge/
border-bottom-styleThe style of the border’s bottom edge.
border-left-styleThe style of the border’s left edge.
border-width .. _border-width-prop:
The width of the border. Equivalent to setting
border-top-width,border-right-width,border-bottom-width, andborder-left-width.This property is supported by
QAbstractItemViewsubclasses,QAbstractSpinBoxsubclasses,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit,QMenu,QMenuBar,QPushButton,QRadioButton,QSplitter,QTextEdit, andQToolTip.Example:
QLineEdit { border-width: 2px; border-style: solid; border-color: darkblue; }See also border-color , border-radius , border-style , border-image , and The Box Model .
border-top-widthThe width of the border’s top edge.
border-right-widthThe width of the border’s right edge.
border-bottom-widthThe width of the border’s bottom edge.
border-left-widthThe width of the border’s left edge.
bottom .. _bottom-prop:
If position is
relative(the default), moves a subcontrol by a certain offset up; specifyingbottom:yis then equivalent to specifying `` top : -y``.If position is
absolute, thebottomproperty specifies the subcontrol’s bottom edge in relation to the parent’s bottom edge (see also subcontrol-origin ).Example:
QSpinBox::down-button { bottom: 2px }button-layout .. _button-layout-prop:
The layout of buttons in a
QDialogButtonBoxor aQMessageBox. The possible values are 0 (WinLayout), 1 (MacLayout), 2 (KdeLayout), 3 (GnomeLayout) and 5 (AndroidLayout).If this property is not specified, it defaults to the value specified by the current style for the
SH_DialogButtonLayoutstyle hint.Example:
* { button-layout: 2 }color .. _color-prop:
The color used to render text.
This property is supported by all widgets that respect the
palette.If this property is not set, the default is whatever is set for in the widget’s palette for the
foregroundRole(typically black).Example:
QPushButton { color: red }See also background and selection-color .
dialogbuttonbox-buttons-have-icons
Whether the buttons in a
QDialogButtonBoxshow iconsIf this property is set to 1, the buttons of a
QDialogButtonBoxshow icons; if it is set to 0, the icons are not shown.See the List of Icons section for information on how to set icons.
QDialogButtonBox { dialogbuttonbox-buttons-have-icons: 1; }Note
Styles defining this property must be applied before the
QDialogButtonBoxis created; this means that you must apply the style to the parent widget or to the application itself.font .. _font-prop:
Shorthand notation for setting the text’s font. Equivalent to specifying
font-family,font-size,font-style, and/orfont-weight.This property is supported by all widgets that respect the
font.If this property is not set, the default is the
font.Example:
QCheckBox { font: bold italic large "Times New Roman" }
font-familyString
The font family.
Example:
QCheckBox { font-family: "New Century Schoolbook" }
font-sizeThe font size. In this version of Qt, only pt and px metrics are supported.
Example:
QTextEdit { font-size: 12px }
font-styleThe font style.
Example:
QTextEdit { font-style: italic }
font-weightThe weight of the font.
gridline-color* .. _gridline-color-prop:
The color of the grid line in a
QTableView.If this property is not specified, it defaults to the value specified by the current style for the
SH_Table_GridLineColorstyle hint.Example:
* { gridline-color: gray }height .. _height-prop:
The height of a subcontrol (or in some case, a widget).
If this property is not specified, it defaults to a value that depends on the subcontrol/widget and on the current style.
Warning
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.
Example:
QSpinBox::down-button { height: 10px }See also width .
icon .. _icon-prop:
Url +
The icon that is used, for widgets that have an icon.
The only widget currently supporting this property is
QPushButton.Note
It’s the application’s responsibility to assign an icon to a button (using the
QAbstractButtonAPI), and not the style’s. So be careful setting it unless your stylesheet is targeting a specific application.Available since 5.15.
icon-size .. _icon-size-prop:
The width and height of the icon in a widget.
The icon size of the following widgets can be set using this property.
QCheckBox
QListView
QPushButton
QRadioButton
QTabBar
QToolBar
QToolBox
QTreeViewimage* .. _image-prop:
Url +
The image that is drawn in the contents rectangle of a subcontrol.
The image property accepts a list of Url s or an
svg. The actual image that is drawn is determined using the same algorithm asQIcon(i.e) the image is never scaled up but always scaled down if necessary. If asvgis specified, the image is scaled to the size of the contents rectangle.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.
Warning
The
QIconSVG plugin is needed to render SVG images.Example:
// implicitly sets the size of down-button to the // size of spindown.png QSpinBox::down-button { image: url(:/images/spindown.png) }image-position .. _image-position-prop:
In Qt 4.3 and later, the alignment of the image image’s position can be specified using relative or absolute position.
left .. _left-prop:
If position is
relative(the default), moves a subcontrol by a certain offset to the right.If position is
absolute, theleftproperty specifies the subcontrol’s left edge in relation to the parent’s left edge (see also subcontrol-origin ).If this property is not specified, it defaults to
0.Example:
QSpinBox::down-button { left: 2px }lineedit-password-character* .. _lineedit-password-character-prop:
The
QLineEditpassword character as a Unicode number.If this property is not specified, it defaults to the value specified by the current style for the
SH_LineEdit_PasswordCharacterstyle hint.Example:
* { lineedit-password-character: 9679 }lineedit-password-mask-delay* .. _lineedit-password-mask-delay-prop:
The
QLineEditpassword mask delay in milliseconds before lineedit-password-character is applied to visible character.If this property is not specified, it defaults to the value specified by the current style for the
SH_LineEdit_PasswordMaskDelaystyle hint.This property was added in Qt 5.4.
Example:
* { lineedit-password-mask-delay: 1000 }margin .. _margin-prop:
The widget’s margins. Equivalent to specifying
margin-top,margin-right,margin-bottom, andmargin-left.This property is supported by
QAbstractItemViewsubclasses,QAbstractSpinBoxsubclasses,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit,QMenu,QMenuBar,QPushButton,QRadioButton,QSplitter,QTextEdit, andQToolTip.If this property is not specified, it defaults to
0.Example:
QLineEdit { margin: 2px }See also padding , spacing , and The Box Model .
margin-topThe widget’s top margin.
margin-rightThe widget’s right margin.
margin-bottomThe widget’s bottom margin.
margin-leftThe widget’s left margin.
max-height .. _max-height-prop:
The widget’s or a subcontrol’s maximum height.
This property is supported by
QAbstractItemViewsubclasses,QAbstractSpinBoxsubclasses,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit,QMenu,QMenuBar,QPushButton,QRadioButton,QSizeGrip,QSpinBox,QSplitter,QStatusBar,QTextEdit, andQToolTip.The value is relative to the contents rect in the box model .
Example:
QSpinBox { max-height: 24px }See also max-width .
max-width .. _max-width-prop:
The widget’s or a subcontrol’s maximum width.
This property is supported by
QAbstractItemViewsubclasses,QAbstractSpinBoxsubclasses,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit,QMenu,QMenuBar,QPushButton,QRadioButton,QSizeGrip,QSpinBox,QSplitter,QStatusBar,QTextEdit, andQToolTip.The value is relative to the contents rect in the box model .
Example:
QComboBox { max-width: 72px }See also max-height .
messagebox-text-interaction-flags* .. _messagebox-text-interaction-flags-prop:
The interaction behavior for text in a message box. Possible values are based on
TextInteractionFlags.If this property is not specified, it defaults to the value specified by the current style for the
SH_MessageBox_TextInteractionFlagsstyle hint.Example:
QMessageBox { messagebox-text-interaction-flags: 5 }min-height .. _min-height-prop:
The widget’s or a subcontrol’s minimum height.
This property is supported by
QAbstractItemViewsubclasses,QAbstractSpinBoxsubclasses,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit,QMenu,QMenuBar,QPushButton,QRadioButton,QSizeGrip,QSpinBox,QSplitter,QStatusBar,QTextEdit,QToolButton, andQToolTip.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 model .
Example:
QComboBox { min-height: 24px }Note
Setting this property might allow widgets to shrink smaller than the space required for the contents.
See also min-width .
min-width .. _min-width-prop:
The widget’s or a subcontrol’s minimum width.
This property is supported by
QAbstractItemViewsubclasses,QAbstractSpinBoxsubclasses,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit,QMenu,QMenuBar,QPushButton,QRadioButton,QSizeGrip,QSpinBox,QSplitter,QStatusBar,QTextEdit,QToolButton, andQToolTip.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 model .
Example:
QComboBox { min-width: 72px }Note
Setting this property might allow widgets to shrink smaller than the space required for the contents.
See also min-height .
opacity* .. _opacity-prop:
The opacity for a widget. Possible values are from 0 (transparent) to 255 (opaque). For the moment, this is only supported for
tooltips.If this property is not specified, it defaults to the value specified by the current style for the
SH_ToolTipLabel_Opacitystyle hint.Example:
QToolTip { opacity: 223 }outline
The outline drawn around the object’s border.
outline-color
The color of the outline. See also border-color
outline-offset
The outline’s offset from the border of the widget.
outline-style
Specifies the pattern used to draw the outline. See also border-style
outline-radius
Adds rounded corners to the outline
outline-bottom-left-radius
The radius for the bottom-left rounded corner of the outline.
outline-bottom-right-radius
The radius for the bottom-right rounded corner of the outline.
outline-top-left-radius
The radius for the top-left corner of the outline.
outline-top-right-radius
The radius for the top-right rounded corner of the outline.
padding .. _padding-prop:
The widget’s padding. Equivalent to specifying
padding-top,padding-right,padding-bottom, andpadding-left.This property is supported by
QAbstractItemViewsubclasses,QAbstractSpinBoxsubclasses,QCheckBox,QComboBox,QFrame,QGroupBox,QLabel,QLineEdit,QMenu,QMenuBar,QPushButton,QRadioButton,QSplitter,QTextEdit, andQToolTip.If this property is not specified, it defaults to
0.Example:
QLineEdit { padding: 3px }See also margin , spacing , and The Box Model .
padding-topThe widget’s top padding.
padding-rightThe widget’s right padding.
padding-bottomThe widget’s bottom padding.
padding-leftThe widget’s left padding.
paint-alternating-row-colors-for-empty-area .. _paint-alternating-row-colors-for-empty-area-prop:
boolWhether the
QTreeViewpaints alternating row colors for the empty area (i.e the area where there are no items)placeholder-text-color* .. _placeholder-text-color-prop:
The color used for the placeholder text of text editing widgets.
If this property is not set, the default value is whatever is set for the palette’s
PlaceholderTextrole.Example:
QLineEdit { placeholder-text-color: #800000ff } /* semi-transparent blue */Available since 6.5.
position .. _position-prop:
relative|absoluteWhether offsets specified using left , right , top , and bottom are relative or absolute coordinates.
If this property is not specified, it defaults to
relative.right .. _right-prop:
If position is
relative(the default), moves a subcontrol by a certain offset to the left; specifyingright:xis then equivalent to specifying `` left : -x``.If position is
absolute, therightproperty specifies the subcontrol’s right edge in relation to the parent’s right edge (see also subcontrol-origin ).Example:
QSpinBox::down-button { right: 2px }selection-background-color* .. _selection-background-color-prop:
The background of selected text or items.
This property is supported by all widgets that respect the
paletteand that show selection text.If this property is not set, the default value is whatever is set for the palette’s
Highlightrole.Example:
QTextEdit { selection-background-color: darkblue }See also selection-color and background .
selection-color* .. _selection-color-prop:
The foreground of selected text or items.
This property is supported by all widgets that respect the
paletteand that show selection text.If this property is not set, the default value is whatever is set for the palette’s
HighlightedTextrole.Example:
QTextEdit { selection-color: white }See also selection-background-color and color .
show-decoration-selected* .. _show-decoration-selected-prop:
Controls whether selections in a
QListViewcover the entire row or just the extent of the text.If this property is not specified, it defaults to the value specified by the current style for the
SH_ItemView_ShowDecorationSelectedstyle hint.Example:
* { show-decoration-selected: 1 }spacing* .. _spacing-prop:
Internal spacing in the widget.
This property is supported by
QCheckBox, checkableQGroupBoxes,QMenuBar, andQRadioButton.If this property is not specified, the default value depends on the widget and on the current style.
Example:
QMenuBar { spacing: 10 }subcontrol-origin* .. _subcontrol-origin-prop:
The origin rectangle of the subcontrol within the parent element.
If this property is not specified, the default is
padding.Example:
QSpinBox::up-button { image: url(:/images/spinup.png); subcontrol-origin: content; subcontrol-position: right top; }See also subcontrol-position .
subcontrol-position* .. _subcontrol-position-prop:
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.
Example:
QSpinBox::down-button { image: url(:/images/spindown.png); subcontrol-origin: padding; subcontrol-position: right bottom; }See also subcontrol-origin .
titlebar-show-tooltips-on-buttons} .. _titlebar-show-tooltips-on-buttons-prop:
boolWhether tool tips are shown on window title bar buttons.
widget-animation-duration* .. _widget-animation-duration:
How much an animation should last (in milliseconds). A value equal to zero means that the animations will be disabled.
If this property is not specified, it defaults to the value specified by the current style for the
SH_Widget_Animation_Durationstyle hint.This property was added in Qt 5.10.
Example:
* { widget-animation-duration: 100 }text-align .. _text-align-prop:
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.
Example:
QPushButton { text-align: left; }This property is currently supported only by
QPushButtonandQProgressBar.text-decoration
noneunderlineoverlineline-throughAdditional text effects
top .. _top-prop:
If position is
relative(the default), moves a subcontrol by a certain offset down.If position is
absolute, thetopproperty specifies the subcontrol’s top edge in relation to the parent’s top edge (see also subcontrol-origin ).If this property is not specified, it defaults to
0.Example:
QSpinBox::up-button { top: 2px }width .. _width-prop:
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.
Warning
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.
Example:
QSpinBox::up-button { width: 12px }See also height .
-qt-background-role
The
background-colorfor the subcontrol or widget based on the chosen role.-qt-style-features
listThe list of CSS properties that you want to apply Qt-specific styles on.
Note
The
listcan only include properties that are not pixmap-based.
List of Icons#
Icons used in Qt can be customized using the following properties. Each of the properties listed in this section have the type Icon .
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.
Name
StandardPixmapbackward-icon
SP_ArrowBackcd-icon
SP_DriveCDIconcomputer-icon
SP_ComputerIcondesktop-icon
SP_DesktopIcondialog-apply-icon
SP_DialogApplyButtondialog-cancel-icon
SP_DialogCancelButtondialog-close-icon
SP_DialogCloseButtondialog-discard-icon
SP_DialogDiscardButtondialog-help-icon
SP_DialogHelpButtondialog-no-icon
SP_DialogNoButtondialog-ok-icon
SP_DialogOkButtondialog-open-icon
SP_DialogOpenButtondialog-reset-icon
SP_DialogResetButtondialog-save-icon
SP_DialogSaveButtondialog-yes-icon
SP_DialogYesButtondirectory-closed-icon
SP_DirClosedIcondirectory-icon
SP_DirIcondirectory-link-icon
SP_DirLinkIcondirectory-open-icon
SP_DirOpenIcondockwidget-close-icon
SP_DockWidgetCloseButtondownarrow-icon
SP_ArrowDowndvd-icon
SP_DriveDVDIconfile-icon
SP_FileIconfile-link-icon
SP_FileLinkIconfiledialog-contentsview-icon
SP_FileDialogContentsViewfiledialog-detailedview-icon
SP_FileDialogDetailedViewfiledialog-end-icon
SP_FileDialogEndfiledialog-infoview-icon
SP_FileDialogInfoViewfiledialog-listview-icon
SP_FileDialogListViewfiledialog-new-directory-icon
SP_FileDialogNewFolderfiledialog-parent-directory-icon
SP_FileDialogToParentfiledialog-start-icon
SP_FileDialogStartfloppy-icon
SP_DriveFDIconforward-icon
SP_ArrowForwardharddisk-icon
SP_DriveHDIconhome-icon
SP_DirHomeIconlineedit-clear-button-icon
SP_LineEditClearButtonleftarrow-icon
SP_ArrowLeftmessagebox-critical-icon
SP_MessageBoxCriticalmessagebox-information-icon
SP_MessageBoxInformationmessagebox-question-icon
SP_MessageBoxQuestionmessagebox-warning-icon
SP_MessageBoxWarningnetwork-icon
SP_DriveNetIconrightarrow-icon
SP_ArrowRighttitlebar-contexthelp-icon
SP_TitleBarContextHelpButtontitlebar-maximize-icon
SP_TitleBarMaxButtontitlebar-menu-icon
SP_TitleBarMenuButtontitlebar-minimize-icon
SP_TitleBarMinButtontitlebar-normal-icon
SP_TitleBarNormalButtontitlebar-shade-icon
SP_TitleBarShadeButtontitlebar-unshade-icon
SP_TitleBarUnshadeButtontrash-icon
SP_TrashIconuparrow-icon
SP_ArrowUp
List of Property Types#
The following table summarizes the syntax and meaning of the different property types.
Type
Syntax
Description
Alignment .. _alignment:
{
top|bottom|left|right|center}*Horizontal and/or vertical alignment.
Example:
QTextEdit { background-position: bottom center }Attachment .. _attachment:
{
scroll|fixed}*Scroll or fixed attachment.
Background .. _background:
Boolean .. _boolean:
0 | 1
True (
1) or false (0).Example:
QDialog { etch-disabled-text: 1 }Border .. _border:
{ Border Style | Length | Brush }*
Shorthand border property.
Border Image .. _border-image:
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.
See the CSS3 Draft Specification for details.
Border Style .. _border-style:
dashed|dot-dash|dot-dot-dash|dotted|double|groove|inset|outset|ridge|solid|noneSpecifies the pattern used to draw a border. See the CSS3 Draft Specification for details.
Box Colors .. _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.
Example:
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 .. _box-lengths:
Length {1,4}
One to four occurrences of Length , 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.
Examples:
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 .. _brush:
Color | Gradient | PaletteRole
Specifies a Color or a Gradient or an entry in the Palette.
Color .. _color:
rgb(r,g,b)|rgba(r,g,b,a)|hsv(h,s,v)|hsva(h,s,v,a)|hsl(h,s,l)|hsla(h,s,l,a)|#rrggbb|Color NameSpecifies a color as RGB (red, green, blue), RGBA (red, green, blue, alpha), HSV (hue, saturation, value), HSVA (hue, saturation, value, alpha), HSL (hue, saturation, lightness), HSLA (hue, saturation, lightness, alpha) or a named color. The
rgb()orrgba()syntax can be used with integer values between 0 and 255, or with percentages. The value of s, v, l and a inhsv(),hsva()hsl()orhsla()must all be in the range 0-255 or with percentages, the value of h must be in the range 0-359. The support for HSL(A) is available since 5.13.Examples:
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, 100%, 100%) } /* opaque yellow */ QLabel { border-color: hsva(240, 255, 255, 75%) } /* 75% blue */ QLabel { border-color: hsl(60, 100%, 50%) } /* opaque yellow */ QLabel { border-color: hsla(240, 255, 50%, 75%) } /* 75% blue */Note
The RGB colors allowed are the same as those allowed with CSS 2.1, as listed here .
Font .. _font:
( Font Style | Font Weight ){0,2} Font Size String
Shorthand font property.
Font Size .. _font-size:
The size of a font.
Font Style .. _font-style:
normal|italic|obliqueThe style of a font.
Font Weight .. _font-weight:
normal|bold|100|200… |900The weight of a font.
Gradient .. _gradient:
qlineargradient|qradialgradient|qconicalgradientSpecifies gradient fills. There are three types of gradient fills:
Linear gradients interpolate colors between start and end points.
Radial gradients interpolate colors between a focal point and end points on a circle surrounding it.
Conical gradients interpolate colors around a center point.
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).
Warning
The stops have to appear sorted in ascending order.
Examples:
/* 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) }Icon .. _icon:
( Url (
disabled|active|normal|selected)? (on|off)? )*A list of url,
ModeandState.Example:
* { 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; }Length .. _length:
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:
px: pixels
pt: the size of one point (i.e., 1/72 of an inch)
em: the size relative to the font size of the element (e.g., 2em means 2 times the size of the font)
ex: the x-height of the font (i.e., the height of ‘x’)However, Qt is limited to font sizes in
ptandpxand any other size must be inpx,emorex.Number .. _number:
A decimal integer or a real number
Examples:
0,18,+127,-255,12.34,-.5,0009.Origin .. _origin:
margin|border|padding|contentIndicates which of four rectangles to use.
margin: The margin rectangle. The margin falls outside the border.
border: The border rectangle. This is where any border is drawn.
padding: The padding rectangle. Unlike the margins, padding is located inside the border.
content: The content rectangle. This specifies where the actual contents go, excluding any padding, border, or margin.See also The Box Model .
PaletteRole .. _paletterole:
alternate-base|base|bright-text|button|button-text|dark|highlight|highlighted-text|light|link|link-visited|mid|midlight|shadow|text|window|window-textThese values correspond the
Color rolesin the widget’sQPalette.For example,
QPushButton { color: palette(dark); }Radius .. _radius:
Length {1, 2}
One or two occurrences of Length . 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:
repeat-x|repeat-y|repeat|no-repeatA value indicating the nature of repetition.
repeat-x: Repeat horizontally.
repeat-y: Repeat vertically.
repeat: Repeat horizontally and vertically.
no-repeat: Don’t repeat.Url .. _url:
url(filename)
filenameis the name of a file on the local disk or stored using The Qt Resource System . Setting an image implicitly sets the width and height of the element.
List of Pseudo-States#
The following pseudo-states are supported:
Pseudo-State
Description
:active.. _active:This state is set when the widget resides in an active window.
:adjoins-item.. _adjoins-item-ps:This state is set when the ::branch of a
QTreeViewis adjacent to an item.
:alternate.. _alternate-ps:This state is set for every alternate row whe painting the row of a
QAbstractItemViewwhenalternatingRowColors()is set to true.
:bottom.. _bottom-ps:The item is positioned at the bottom. For example, a
QTabBarthat has its tabs positioned at the bottom.
:checked.. _checked-ps:The item is checked. For example, the
checkedstate ofQAbstractButton.
:closable.. _closable-ps:The items can be closed. For example, the
QDockWidgethas theDockWidgetClosablefeature turned on.
:closed.. _closed-ps:The item is in the closed state. For example, an non-expanded item in a
QTreeView
:default.. _default-ps:The item is the default. For example, a
defaultQPushButtonor a default action in aQMenu.
:disabled.. _disabled-ps:The item is
disabled.
:editable.. _editable-ps:The
QComboBoxis editable.
:edit-focus.. _edit-focus-ps:The item has edit focus (See
State_HasEditFocus). This state is available only for Qt Extended applications.
:enabled.. _enabled-ps:The item is
enabled.
:exclusive.. _exclusive-ps:The item is part of an exclusive item group. For example, a menu item in a exclusive
QActionGroup.
:first.. _first-ps:The item is the first (in a list). For example, the first tab in a
QTabBar.
:flat.. _flat-ps:The item is flat. For example, a
flatQPushButton.
:floatable.. _floatable-ps:The items can be floated. For example, the
QDockWidgethas theDockWidgetFloatablefeature turned on.
:focus.. _focus-ps:The item has
input focus.
:has-children.. _has-children-ps:The item has children. For example, an item in a
QTreeViewthat has child items.
:has-siblings.. _has-siblings-ps:The item has siblings. For example, an item in a
QTreeViewthat siblings.
:horizontal.. _horizontal-ps:The item has horizontal orientation
:hover.. _hover-ps:The mouse is hovering over the item.
:indeterminate.. _indeterminate-ps:The item has indeterminate state. For example, a
QCheckBoxorQRadioButtonispartially checked.
:last.. _last-ps:The item is the last (in a list). For example, the last tab in a
QTabBar.
:left.. _left-ps:The item is positioned at the left. For example, a
QTabBarthat has its tabs positioned at the left.
:maximized.. _maximized-ps:The item is maximized. For example, a maximized
QMdiSubWindow.
:middle.. _middle-ps: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.. _minimized-ps:The item is minimized. For example, a minimized
QMdiSubWindow.
:movable.. _movable-ps:The item can be moved around. For example, the
QDockWidgethas theDockWidgetMovablefeature turned on.
:no-frame.. _no-frame-ps:The item has no frame. For example, a frameless
QSpinBoxorQLineEdit.
:non-exclusive.. _non-exclusive-ps:The item is part of a non-exclusive item group. For example, a menu item in a non-exclusive
QActionGroup.
:off.. _off-ps:For items that can be toggled, this applies to items in the “off” state.
:on.. _on-ps:For items that can be toggled, this applies to widgets in the “on” state.
:only-one.. _only-one-ps:The item is the only one (in a list). For example, a lone tab in a
QTabBar.
:open.. _open-ps:The item is in the open state. For example, an expanded item in a
QTreeView, or aQComboBoxorQPushButtonwith an open menu.
:next-selected.. _next-selected-ps:The next item (in a list) is selected. For example, the selected tab of a
QTabBaris next to this item.
:pressed.. _pressed-ps:The item is being pressed using the mouse.
:previous-selected.. _previous-selected-ps:The previous item (in a list) is selected. For example, a tab in a
QTabBarthat is next to the selected tab.
:read-only.. _read-only-ps:The item is marked read only or non-editable. For example, a read only
QLineEditor a non-editableQComboBox.
:right.. _right-ps:The item is positioned at the right. For example, a
QTabBarthat has its tabs positioned at the right.
:selected.. _selected-ps:The item is selected. For example, the selected tab in a
QTabBaror the selected item in aQMenu.
:top.. _top-ps:The item is positioned at the top. For example, a
QTabBarthat has its tabs positioned at the top.
:unchecked.. _unchecked-ps:The item is
unchecked.
:vertical.. _vertical-ps:The item has vertical orientation.
:window.. _window-ps:The widget is a window (i.e top level widget)
List of Sub-Controls#
The following subcontrols are available:
Sub-Control
Description
::add-line.. _add-line-sub:The button to add a line of a
QScrollBar.
::add-page.. _add-page-sub:The region between the handle (slider) and the add-line of a
QScrollBar.
::branch.. _branch-sub:The branch indicator of a
QTreeView.
::chunk.. _chunk-sub:The progress chunk of a
QProgressBar.
::close-button.. _close-button-sub:The close button of a
QDockWidgetor tabs ofQTabBar
::corner.. _corner-sub:The corner between two scrollbars in a
QAbstractScrollArea
::down-arrow.. _down-arrow-sub:The down arrow of a
QComboBox,QHeaderView(sort indicator),QScrollBarorQSpinBox.
::down-button.. _down-button-sub:The down button of a
QScrollBaror aQSpinBox.
::drop-down.. _drop-down-sub:The drop-down button of a
QComboBox.
::float-button.. _float-button-sub:The float button of a
QDockWidget
::groove.. _groove-sub:The groove of a
QSlider.
::indicator.. _indicator-sub:The indicator of a
QAbstractItemView, aQCheckBox, aQRadioButton, a checkableQMenuitem or a checkableQGroupBox.
::handle.. _handle-sub:The handle (slider) of a
QScrollBar, aQSplitter, or aQSlider.
::icon.. _icon-sub:The icon of a
QAbstractItemViewor aQMenu.
::item.. _item-sub:An item of a
QAbstractItemView, aQMenuBar, aQMenu, or aQStatusBar.
::left-arrow.. _left-arrow-sub:The left arrow of a
QScrollBar.
::left-corner.. _left-corner-sub:The left corner of a
QTabWidget. For example, this control can be used to control position the left corner widget in aQTabWidget.
::menu-arrow.. _menu-arrow-sub:The arrow of a
QToolButtonwith a menu.
::menu-button.. _menu-button-sub:The menu button of a
QToolButton.
::menu-indicator.. _menu-indicator-sub:The menu indicator of a
QPushButton.
::right-arrow.. _right-arrow-sub:The right arrow of a
QMenuor aQScrollBar.
::pane.. _pane-sub:The pane (frame) of a
QTabWidget.
::right-corner.. _right-corner-sub:The right corner of a
QTabWidget. For example, this control can be used to control the position the right corner widget in aQTabWidget.
::scroller.. _scroller-sub:The scroller of a
QMenuorQTabBar.
::section.. _section-sub:The section of a
QHeaderView.
::separator.. _separator-sub:The separator of a
QMenuor in aQMainWindow.
::sub-line.. _sub-line-sub:The button to subtract a line of a
QScrollBar.
::sub-page.. _sub-page-sub:The region between the handle (slider) and the sub-line of a
QScrollBar.
::tab.. _tab-sub:The tab of a
QTabBarorQToolBox.
::tab-bar.. _tab-bar-sub:The tab bar of a
QTabWidget. This subcontrol exists only to control the position of theQTabBarinside theQTabWidget. To style the tabs using the ::tab subcontrol.
::tear.. _tear-sub:The tear indicator of a
QTabBar.
::tearoff.. _tearoff-sub:The tear-off indicator of a
QMenu.
::text.. _text-ps:The text of a
QAbstractItemView.
::title.. _title-sub:The title of a
QGroupBoxor aQDockWidget.
::up-arrow.. _up-arrow-sub:The up arrow of a
QHeaderView(sort indicator),QScrollBaror aQSpinBox.
::up-button.. _up-button-sub:The up button of a
QSpinBox.
See Customizing the QPushButton’s Menu Indicator Sub-Control for an example of how to customize a subcontrol.