Qt Style Sheets Reference
Qt Style Sheets support various properties, pseudo-states, and subcontrols that make it possible to customize the look of widgets.
List of Stylable Widgets
The following table lists the Qt widgets that can be customized using style sheets:
Widget | How to Style |
---|---|
Supports the . All derivatives of , including , and (all item view classes), support scrollable backgrounds using . Setting the background-attachment to See for an example. | |
Supports the . The check indicator can be styled using the subcontrol. By default, the indicator is placed in the Top Left corner of the Contents rectangle of the widget. The property specifies the spacing between the check indicator and the text. See for an example. | |
The grip can be styled be using the property. The arrow indicators can by styled using the subcontrol and the subcontrol. | |
The frame around the combobox can be styled using the . The drop-down button can be styled using the 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 subcontrol. By default, the arrow is placed in the center of the contents rectangle of the drop-down subcontrol. See for an example. | |
See . | |
See . | |
Supports only the , and properties. Warning: Make sure you define the macro for your custom widget. | |
The layout of buttons can be altered using the property. | |
Supports styling of the title bar and the title bar buttons when docked. The dock widget border can be styled using the property. The subcontrol can be used to customize the title bar. The close and float buttons are positioned with respect to the subcontrol using the and respectively. When the title bar is vertical, the pseudo class is set. In addition, depending on, the , and pseudo states are set. Note: Use QMainWindow::separator to style the resize handle. Warning: The style sheet has no effect when the is undocked as Qt uses native top level windows when undocked. See for an example. | |
See . | |
Supports the . Since 4.3, setting a stylesheet on a automatically sets the property to . See for an example. | |
Supports the . The title can be styled using the subcontrol. By default, the title is placed depending on QGroupBox::textAlignment. In the case of a checkable , the title includes the check indicator. The indicator is styled using the subcontrol. The property can be used to control the spacing between the text and indicator. See for an example. | |
Supports the . The sections of the header view are styled using the sub control. The section Sub-control supports the , , , , ,, , and pseudo states. Sort indicator in can be styled using the and the Sub-control. See for an example. | |
Supports the . Does not support the pseudo-state. Since 4.3, setting a stylesheet on a automatically sets the property to . See for an example (a derives from ). | |
Support the . The color and background of the selected item is styled using and respectively. The password character can be styled using the property. The password mask delay can be changed using the See for an example. | |
Supports the . When is enabled, the alternating colors can be styled using the property. The color and background of the selected item is styled using and respectively. The selection behavior is controlled by the property. Use the subcontrol for more fine grained control over the items in the . See to style scrollable backgrounds. See for an example. | |
See . | |
Supports styling of the separator The separator in a when using is styled using the subcontrol. See for an example. | |
Supports the . Individual items are styled using the subcontrol. In addition to the usually supported pseudo states, The indicator of checkable menu items is styled using the subcontrol. The separator is styled using the subcontrol. For items with a sub menu, the arrow marks are styled using the and . The scroller is styled using the . The tear-off is styled using the . See for an example. | |
Supports the . The property specifies the spacing between menu items. Individual items are styled using the 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 for an example. | |
The property can be used to alter the interaction with text in the message box. | |
Supports the . The chunks of the progress bar can be styled using the subcontrol. The chunk is displayed on the Contents rectangle of the widget. If the progress bar displays text, use the property to position the text. Indeterminate progress bars have the pseudo state set. See for an example. | |
Supports the . Supports the , , pseudo states. For with a menu, the menu indicator is styled using the subcontrol. Appearance of checkable push buttons can be customized using the and pseudo-states. Warning: If you only set a background-color on a , the background may not appear unless you set the border property to some value. This is because, by default, the draws a native border which completely overlaps the background-color. For example, { background-color: red; border: none; } See for an example. | |
Supports the . The check indicator can be styled using the subcontrol. By default, the indicator is placed in the Top Left corner of the Contents rectangle of the widget. The property specifies the spacing between the check indicator and the text. See for an example. | |
Supports the . The Contents rectangle of the widget is considered to be the groove over which the slider moves. The extent of the (i.e the width or the height depending on the orientation) is set using the or property respectively. To determine the orientation, use the and the pseudo states. The slider can be styled using the subcontrol. Setting the or provides size contraints for the slider depending on the orientation. The 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 or . By default, the arrows are placed in the center of the Contents rectangle of the add-line subcontrol. The 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 or . By default, the arrows are placed in the center of the Contents rectangle of the sub-line subcontrol. The subcontrol can be used to style the region of the slider that subtracts a page. The subcontrol can be used to style the region of the slider that adds a page. See for an example. | |
Supports the , , and properties. See for an example. | |
Supports the . For horizontal slides, the and properties must be provided. For vertical sliders, the and properties must be provided. The groove of the slider is styled using the . The groove is positioned by default in the Contents rectangle of the widget. The thumb of the slider is styled using subcontrol. The subcontrol moves in the Contents rectangle of the groove subcontrol. See for an example. | |
The frame of the spin box can be styled using the . The up button and arrow can be styled using the and 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 and 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 for an example. | |
Supports the . The handle of the splitter is styled using the subcontrol. See for an example. | |
Supports only the property. The frame for individual items can be style using the subcontrol. See for an example. | |
Individual tabs may be styled using the subcontrol. Close buttons using the The tabs support the , , , , , , pseudo states. The , , , pseudo states depending on the orientation of the tabs. Overlapping tabs for the selected state are created by using negative margins or using the The tear indicator of the is styled using the subcontrol. used two QToolButtons for its scrollers that can be styled using the The alignment of the tabs within the is styled using the property. Warning: To change the position of the within a , use the subcontrol (and set subcontrol-position). See for an example. | |
The frame of the tab widget is styled using the subcontrol. The left and right corners are styled using the and respectively. The position of the tab bar is controlled using the subcontrol. By default, the subcontrols have positions of a in the QWindowsStyle. To place the in the center, set the subcontrol-position of the tab-bar subcontrol. The , , , pseudo states depending on the orientation of the tabs. See for an example. | |
Supports the . When is enabled, the alternating colors can be styled using the property. The color and background of the selected item is styled using and respectively. The corner widget in a is implemented as a and can be styled using the " QTableCornerButton::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 property. See to style scrollable backgrounds. See for an example. | |
See . | |
Supports the . The color and background of selected text is styled using and respectively. See to style scrollable backgrounds. | |
See . | |
Supports the . The , , , pseudo states depending on the area in which the tool bar is grouped. The , , , pseudo states indicator the position of the tool bar within a line group (See ). The separator of a is styled using the subcontrol. The handle (to move the toolbar) is styled using the subcontrol. See for an example. | |
Supports the . If the has a menu, is 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 is in mode, the subcontrol is used to draw the menu button. 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 displays arrows, the , , and subcontrols are used. Warning: If you only set a background-color on a , the background will not appear unless you set the border property to some value. This is because, by default, the draws a native border which completely overlaps the background-color. For example, { background-color: red; border: none; } See for an example. | |
Supports the . The individual tabs can by styled using the subcontrol. The tabs support the ,, , , , , pseudo states. | |
Supports the . The property controls the opacity of the tooltip. See for an example (a is a ). | |
Supports the . When is enabled, the alternating colors can be styled using the property. The color and background of the selected item is styled using and respectively. The selection behavior is controlled by the property. The branches of the tree view can be styled using the subcontrol. The ::branch Sub-control supports the , , and pseudo states. Use the subcontrol for more fine grained control over the items in the . See to style scrollable backgrounds. See for an example to style the branches. | |
See . | |
Supports only the , and properties. If you subclass from , you need to provide a paintEvent for your custom as below: void CustomWidget::paintEvent( *){ opt; opt.init(this); p(this); style()->drawPrimitive(::PE_Widget, &opt, &p, this); } The above code is a no-operation if there is no stylesheet set. Warning: Make sure you define the macro 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 . 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 | The used in subclasses. If this property is not set, the default value is whatever is set for the palette's role. Example: { alternate-background-color: blue; background: yellow;} See also and . | |
background | Shorthand notation for setting the background. Equivalent to specifying background-color ,background-image , background-repeat , and/orbackground-position . This property is supported by subclasses, subclasses, ,, , , ,, , , ,, , ,, , and plain s. Example: { background: yellow } Often, it is required to set a fill pattern similar to the styles in . You can use the background-color property for, , and. The other patterns are easily achieved by creating a background image that contains the pattern. Example: { background-image: url(dense6pattern.png); background-repeat: repeat-xy; } See also , , , and . | |
background-color | The background color used for the widget. Examples: { background-color: yellow } { background-color: rgb(255, 0, 0) } | |
background-image | The background image used for the widget. Semi-transparent parts of the image let thebackground-color shine through. Example: { background-image: url(:/images/hydro.png) } | |
background-repeat | Whether and how the background image is repeated to fill the background-origin rectangle. If this property is not specified, the background image is repeated in both directions ( Example: { background: white url(:/images/ring.png); background-repeat: repeat-y; background-position: left; } | |
background-position | The alignment of the background image within the background-origin rectangle. If this property is not specified, the alignment is Example: { background: url(:/images/footer.png); background-position: bottom left; } | |
background-attachment | Determines whether the background-image in a is scrolled or fixed with respect to the viewport. By default, the background-image scrolls with the viewport. Example: { background-image: url("leaves.png"); background-attachment: fixed;} See also | |
background-clip | The widget's rectangle, in which thebackground is drawn. This property specifies the rectangle to which the This property is supported by subclasses, subclasses, ,, , , ,, , ,, , , and plains. If this property is not specified, the default is Example: { background-image: url(:/images/header.png); background-position: top left; background-origin: content; background-clip: padding; } See also , and. | |
background-origin | The widget's background rectangle, to use in conjunction with background-position andbackground-image . This property is supported by subclasses, subclasses, ,, , , ,, , ,, , , and plains. If this property is not specified, the default is Example: { background-image: url(:/images/header.png); background-position: top left; background-origin: content; } See also and . | |
border | Shorthand notation for setting the widget's border. Equivalent to specifying border-color ,border-style , and/or border-width . This property is supported by subclasses, subclasses, ,, , , ,, , , ,, , ,, and plain s. Example: { border: 1px solid white } | |
border-top | Shorthand notation for setting the widget's top border. Equivalent to specifyingborder-top-color , border-top-style , and/orborder-top-width . | |
border-right | Shorthand notation for setting the widget's right border. Equivalent to specifyingborder-right-color , border-right-style , and/or border-right-width . | |
border-bottom | Shorthand notation for setting the widget's bottom border. Equivalent to specifyingborder-bottom-color , border-bottom-style , and/or border-bottom-width . | |
border-left | Shorthand notation for setting the widget's left border. Equivalent to specifyingborder-left-color , border-left-style , and/or border-left-width . | |
border-color | The color of all the border's edges. Equivalent to specifying border-top-color ,border-right-color , border-bottom-color , and border-left-color . This property is supported by subclasses, subclasses, ,, , , ,, , , ,, , ,, and plain s. If this property is not specified, it defaults to (i.e., the widget's foreground color). Example: { border-width: 1px; border-style: solid; border-color: white; } See also , , , and . | |
border-top-color | The color of the border's top edge. | |
border-right-color | The color of the border's right edge. | |
border-bottom-color | The color of the border's bottom edge. | |
border-left-color | The color of the border's left edge. | |
border-image | The image used to fill the border. The image is cut into nine parts and stretched appropriately if necessary. See for details. This property is supported by subclasses, subclasses, ,, , , ,, , , ,, , and. See also , , , and . | |
border-radius | 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. This property is supported by subclasses, subclasses, ,, , , ,, , , ,, , , and. If this property is not specified, it defaults to 0. Example: { border-width: 1px; border-style: solid; border-radius: 4px; } See also and . | |
border-top-left-radius | The radius of the border's top-left corner. | |
border-top-right-radius | The radius of the border's top-right corner. | |
border-bottom-right-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 | The radius of the border's bottom-left corner. Setting this property to a positive value results in a rounded corner. | |
border-style | The style of all the border's edges. This property is supported by subclasses, subclasses, ,, , , ,, , , ,, , , and. If this property is not specified, it defaults to Example: { border-width: 1px; border-style: solid; border-color: blue; } See also , , , and . | |
border-top-style | The style of the border's top edge. | |
border-right-style | The style of the border's right edge/ | |
border-bottom-style | The style of the border's bottom edge. | |
border-left-style | The style of the border's left edge. | |
border-width | The width of the border. Equivalent to settingborder-top-width , border-right-width ,border-bottom-width , and border-left-width . This property is supported by subclasses, subclasses, ,, , , ,, , , ,, , , and. Example: { border-width: 2px; border-style: solid; border-color: darkblue; } See also , , , , and . | |
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 | If is relative (the default), moves a subcontrol by a certain offset up; specifyingbottom: y is then equivalent to specifying: -y . If is Example: ::down-button { bottom: 2px } See also , , and . | |
button-layout | The layout of buttons in a or a . The possible values are 0 (), 1 (), 2 (), and 3 (). If this property is not specified, it defaults to the value specified by the current style for the style hint. Example: * { button-layout: 2 } | |
color | The color used to render text. This property is supported by all widgets that respect the . If this property is not set, the default is whatever is set for in the widget's palette for the (typically black). Example: { color: red } See also and . | |
dialogbuttonbox-buttons-have-icons | Whether the buttons in a show icons If this property is set to 1, the buttons of a show icons; if it is set to 0, the icons are not shown. See the section for information on how to set icons. { dialogbuttonbox-buttons-have-icons: 1; } Note: Styles defining this property must be applied before the is created; this means that you must apply the style to the parent widget or to the application itself. | |
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 . If this property is not set, the default is the. Example: { font: bold italic large "Times New Roman" } | |
font-family | String | The font family. Example: { font-family: "New Century Schoolbook" } |
font-size | The font size. In this version of Qt, only pt and px metrics are supported. Example: { font-size: 12px } | |
font-style | The font style. Example: { font-style: italic } | |
font-weight | The weight of the font. | |
gridline-color * | The color of the grid line in a . If this property is not specified, it defaults to the value specified by the current style for the style hint. Example: * { gridline-color: gray } | |
height | 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 and to the same value. Example: ::down-button { height: 10px } See also . | |
icon-size | The width and height of the icon in a widget. The icon size of the following widgets can be set using this property. | |
image * | + | The image that is drawn in the contents rectangle of a subcontrol. The image property accepts a list of 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. This property is for subcontrols only--we don't support it for other elements. Warning: The SVG plugin is needed to render SVG images. Example: /* implicitly sets the size of down-button to the size of spindown.png */::down-button { image: url(:/images/spindown.png) } |
image-position | In Qt 4.3 and later, the alignment of the image image's position can be specified using relative or absolute position. | |
left | If is relative (the default), moves a subcontrol by a certain offset to the right. If is If this property is not specified, it defaults to Example: ::down-button { left: 2px } See also , , and . | |
lineedit-password-character* | The password character as a Unicode number. If this property is not specified, it defaults to the value specified by the current style for the style hint. Example: * { lineedit-password-character: 9679 } | |
lineedit-password-mask-delay* | The password mask delay in milliseconds before is applied to visible character. If this property is not specified, it defaults to the value specified by the current style for the style hint. This property was added in Qt 5.4. Example: * { lineedit-password-mask-delay: 1000 } | |
margin | The widget's margins. Equivalent to specifyingmargin-top , margin-right , margin-bottom , and margin-left . This property is supported by subclasses, subclasses, ,, , , ,, , , ,, , , and. If this property is not specified, it defaults to Example: { margin: 2px } See also , , and . | |
margin-top | The widget's top margin. | |
margin-right | The widget's right margin. | |
margin-bottom | The widget's bottom margin. | |
margin-left | The widget's left margin. | |
max-height | The widget's or a subcontrol's maximum height. This property is supported by subclasses, subclasses, ,, , , ,, , , ,, , ,, , , and. The value is relative to the contents rect in the. Example: { max-height: 24px } See also . | |
max-width | The widget's or a subcontrol's maximum width. This property is supported by subclasses, subclasses, ,, , , ,, , , ,, , ,, , , and. The value is relative to the contents rect in the. Example: { max-width: 72px } See also . | |
messagebox-text-interaction-flags* | The interaction behavior for text in a message box. Possible values are based on. If this property is not specified, it defaults to the value specified by the current style for the style hint. Example: { messagebox-text-interaction-flags: 5 } | |
min-height | The widget's or a subcontrol's minimum height. This property is supported by subclasses, subclasses, ,, , , ,, , , ,, , ,, , , and. 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. Example: { min-height: 24px } See also . | |
min-width | The widget's or a subcontrol's minimum width. This property is supported by subclasses, subclasses, ,, , , ,, , , ,, , ,, , , and. 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. Example: { min-width: 72px } See also . | |
opacity* | The opacity for a widget. Possible values are from 0 (transparent) to 255 (opaque). For the moment, this is only supported for . If this property is not specified, it defaults to the value specified by the current style for the style hint. Example: { opacity: 223 } | |
padding | The widget's padding. Equivalent to specifyingpadding-top , padding-right ,padding-bottom , and padding-left . This property is supported by subclasses, subclasses, ,, , , ,, , , ,, , , and. If this property is not specified, it defaults to Example: { padding: 3px } See also , , and . | |
padding-top | The widget's top padding. | |
padding-right | The widget's right padding. | |
padding-bottom | The widget's bottom padding. | |
padding-left | The widget's left padding. | |
paint-alternating-row-colors-for-empty-area | bool | Whether the paints alternating row colors for the empty area (i.e the area where there are no items) |
position | relative | absolute | Whether offsets specified using , ,, and are relative or absolute coordinates. If this property is not specified, it defaults to |
right | If is relative (the default), moves a subcontrol by a certain offset to the left; specifying right: x is then equivalent to specifying : -x . If is Example: ::down-button { right: 2px } See also , , and . | |
selection-background-color* | The background of selected text or items. This property is supported by all widgets that respect the and that show selection text. If this property is not set, the default value is whatever is set for the palette's role. Example: { selection-background-color: darkblue } See also and . | |
selection-color* | The foreground of selected text or items. This property is supported by all widgets that respect the and that show selection text. If this property is not set, the default value is whatever is set for the palette's role. Example: { selection-color: white } See also and. | |
show-decoration-selected* | Controls whether selections in a cover 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 style hint. Example: * { show-decoration-selected: 1 } | |
spacing* | Internal spacing in the widget. This property is supported by , checkable es, , and. If this property is not specified, the default value depends on the widget and on the current style. Example: { spacing: 10 } See also and . | |
subcontrol-origin* | The origin rectangle of the subcontrol within the parent element. If this property is not specified, the default is Example: ::up-button { image: url(:/images/spinup.png); subcontrol-origin: content; subcontrol-position: right top; } See also . | |
subcontrol-position* | The alignment of the subcontrol within the origin rectangle specified by . If this property is not specified, it defaults to a value that depends on the subcontrol. Example: ::down-button { image: url(:/images/spindown.png); subcontrol-origin: padding; subcontrol-position: right bottom; } See also . | |
text-align | 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: { text-align: left;} This property is currently supported only by and . | |
text-decoration | none underline overline line-through | Additional text effects |
top | If is relative (the default), moves a subcontrol by a certain offset down. If is If this property is not specified, it defaults to Example: ::up-button { top: 2px } See also , , and . | |
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. Warning: Unless otherwise specified, this property has no effect when set on widgets. If you want a widget with a fixed width, set the and to the same value. Example: ::up-button { width: 12px } See also . |
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 .
Note that for icons to appear in buttons in a , 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 | |
---|---|
backward-icon | |
cd-icon | |
computer-icon | |
desktop-icon | |
dialog-apply-icon | |
dialog-cancel-icon | |
dialog-close-icon | |
dialog-discard-icon | |
dialog-help-icon | |
dialog-no-icon | |
dialog-ok-icon | |
dialog-open-icon | |
dialog-reset-icon | |
dialog-save-icon | |
dialog-yes-icon | |
directory-closed-icon | |
directory-icon | |
directory-link-icon | |
directory-open-icon | |
dockwidget-close-icon | |
downarrow-icon | |
dvd-icon | |
file-icon | |
file-link-icon | |
filedialog-contentsview-icon | |
filedialog-detailedview-icon | |
filedialog-end-icon | |
filedialog-infoview-icon | |
filedialog-listview-icon | |
filedialog-new-directory-icon | |
filedialog-parent-directory-icon | |
filedialog-start-icon | |
floppy-icon | |
forward-icon | |
harddisk-icon | |
home-icon | |
leftarrow-icon | |
messagebox-critical-icon | |
messagebox-information-icon | |
messagebox-question-icon | |
messagebox-warning-icon | |
network-icon | |
rightarrow-icon | |
titlebar-contexthelp-icon | |
titlebar-maximize-icon | |
titlebar-menu-icon | |
titlebar-minimize-icon | |
titlebar-normal-icon | |
titlebar-shade-icon | |
titlebar-unshade-icon | |
trash-icon | |
uparrow-icon |
List of Property Types
The following table summarizes the syntax and meaning of the different property types.
Type | Syntax | Description |
---|---|---|
Alignment | { top | bottom | left | right | center }* | Horizontal and/or vertical alignment. Example: { background-position: bottom center } |
Attachment | { scroll | fixed }* | Scroll or fixed attachment. |
Background | { | | | }* | A sequence of , , , and . |
Boolean | 0 | 1 | True (1 ) or false (0 ). Example: { etch-disabled-text: 1 } |
Border | { | | }* | Shorthand border property. |
Border Image | none | {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. See the for details. |
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 for details. |
Box Colors | {1,4} | One to four occurrences of , 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: { border-color: red } /* red red red red */ { border-color: red blue } /* red blue red blue */ { border-color: red blue green } /* red blue green blue */ { 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. Examples: { border-width: 1px } /* 1px 1px 1px 1px */ { border-width: 1px 2px } /* 1px 2px 1px 2px */ { border-width: 1px 2px 3px } /* 1px 2px 3px 2px */ { border-width: 1px 2px 3px 4px } /* 1px 2px 3px 4px */ |
Brush | | | | Specifies a Color or a Gradient or an entry in the Palette. |
Color | rgb(r, g, b) | rgba(r, g, b, a) | hsv(h, s, v) | hsva(h, s, v, a) | #rrggbb | | 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() orhsva() must all be in the range 0-255; the value of h must be in the range 0-359. Examples: { border-color: red } /* opaque red */ { border-color: #FF0000 } /* opaque red */ { border-color: rgba(255, 0, 0, 75%) } /* 75% opaque red */ { border-color: rgb(255, 0, 0) } /* opaque red */ { border-color: rgb(100%, 0%, 0%) } /* opaque red */ { border-color: hsv(60, 255, 255) } /* opaque yellow */ { border-color: hsva(240, 255, 255, 75%) } /* 75% blue */ Note: The RGB colors allowed are the same as those allowed with CSS 2.1, as listed . |
Font | ( | ){0,2} String | Shorthand font property. |
Font Size | The size of a font. | |
Font Style | normal | italic | oblique | The style of a font. |
Font Weight | normal | bold | 100 | 200 ... | 900 | The weight of a font. |
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). Warning: The stops have to appear sorted in ascending order. Examples: /* linear gradient from white to green */ { 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 */ { 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 */ { background: qconicalgradient(cx:0.5, cy:0.5, angle:30, stop:0 white, stop:1 #00FF00) } /* radial gradient from white to green */ { background: qradialgradient(cx:0, cy:0, radius: 1, fx:0.5, fy:0.5, stop:0 white, stop:1 green) } |
Icon | ( (disabled |active | normal |selected )? (on |off )? )* | A list of url, and . Example: * { file-icon: url(file.png), url(file_selected.png) selected; } { dialogbuttonbox-buttons-have-icons: true; dialog-ok-icon: url(ok.svg); dialog-cancel-icon: url(cancel.png), url(grayed_cancel.png) disabled; } |
Length | (px | pt |em | ex )? | A number followed by a measurement unit. The CSS standard recommends that user agents must 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 | Examples: 0 , 18 , +127 , -255 , 12.34 , -.5 , 0009 . |
Origin | margin | border | padding | content | Indicates which of four rectangles to use.
See also . |
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 in the widget's . For example, { 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 . 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 | This state is set when the widget resides in an active window. |
:adjoins-item | This state is set when the of a is adjacent to an item. |
:alternate | This state is set for every alternate row whe painting the row of a when() is set to true. |
:bottom | The item is positioned at the bottom. For example, a that has its tabs positioned at the bottom. |
:checked | The item is checked. For example, the state of . |
:closable | The items can be closed. For example, the has the feature turned on. |
:closed | The item is in the closed state. For example, an non-expanded item in a |
:default | The item is the default. For example, a or a default action in a . |
:disabled | The item is . |
:editable | The is editable. |
:edit-focus | The item has edit focus (See ). This state is available only for Qt Extended applications. |
:enabled | The item is . |
:exclusive | The item is part of an exclusive item group. For example, a menu item in a exclusive. |
:first | The item is the first (in a list). For example, the first tab in a . |
:flat | The item is flat. For example, a . |
:floatable | The items can be floated. For example, the has the feature turned on. |
:focus | The item has . |
:has-children | The item has children. For example, an item in a that has child items. |
:has-siblings | The item has siblings. For example, an item in a 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 or is . |
:last | The item is the last (in a list). For example, the last tab in a . |
:left | The item is positioned at the left. For example, a that has its tabs positioned at the left. |
:maximized | The item is maximized. For example, a maximized . |
: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. |
:minimized | The item is minimized. For example, a minimized . |
:movable | The item can be moved around. For example, the has the feature turned on. |
:no-frame | The item has no frame. For example, a frameless or . |
:non-exclusive | The item is part of a non-exclusive item group. For example, a menu item in a non-exclusive. |
: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 . |
:open | The item is in the open state. For example, an expanded item in a , or a or with an open menu. |
:next-selected | The next item (in a list) is selected. For example, the selected tab of a 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 that is next to the selected tab. |
:read-only | The item is marked read only or non-editable. For example, a read only or a non-editable . |
:right | The item is positioned at the right. For example, a that has its tabs positioned at the right. |
:selected | The item is selected. For example, the selected tab in a or the selected item in a. |
:top | The item is positioned at the top. For example, a that has its tabs positioned at the top. |
:unchecked | The item is . |
:vertical | The item has vertical orientation. |
:window | The widget is a window (i.e top level widget) |
List of Sub-Controls
The following subcontrols are available:
Sub-Control | Description |
---|---|
::add-line | The button to add a line of a . |
::add-page | The region between the handle (slider) and the of a . |
::branch | The branch indicator of a . |
::chunk | The progress chunk of a . |
::close-button | The close button of a or tabs of |
::corner | The corner between two scrollbars in a |
::down-arrow | The down arrow of a , (sort indicator), or . |
::down-button | The down button of a or a . |
::drop-down | The drop-down button of a . |
::float-button | The float button of a |
::groove | The groove of a . |
::indicator | The indicator of a , a , a , a checkable item or a checkable . |
::handle | The handle (slider) of a , a , or a . |
::icon | The icon of a or a . |
::item | An item of a , a , a , or a . |
::left-arrow | The left arrow of a . |
::left-corner | The left corner of a . For example, this control can be used to control position the left corner widget in a . |
::menu-arrow | The arrow of a with a menu. |
::menu-button | The menu button of a . |
::menu-indicator | The menu indicator of a . |
::right-arrow | The right arrow of a or a . |
::pane | The pane (frame) of a . |
::right-corner | The right corner of a . For example, this control can be used to control the position the right corner widget in a . |
::scroller | The scroller of a or . |
::section | The section of a . |
::separator | The separator of a or in a . |
::sub-line | The button to subtract a line of a . |
::sub-page | The region between the handle (slider) and the of a . |
::tab | The tab of a or . |
::tab-bar | The tab bar of a . This subcontrol exists only to control the position of the inside the . To style the tabs using the subcontrol. |
::tear | The tear indicator of a . |
::tearoff | The tear-off indicator of a . |
::text | The text of a . |
::title | The title of a or a . |
::up-arrow | The up arrow of a (sort indicator), or a . |
::up-button | The up button of a . |