本文主要是介绍Qt总结之QSS,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
参考Qt帮助手册(Qt Style Sheets Reference)
- 选择器
Universal Selector *
Type Selector QPushButton
Property Selector QPushButton[flat="false"]
Class Selector .QPushButton
ID Selector QPushButton#okButton
Descendant Selector QDialog QPushButton (作用于QDialog及其子类所包含的所有QPushbutton)
Child Selector QDialog > QPushButton (仅作用于QDialog的直接子类QPushbutton,对QDialog派生类型所包含的QPushbutton没影响)
- 属性
//background:
alternate-background-color
selection-background-color
background
background-color
background-image (url(:/xxx))
background-repeat (repeat-x | repeat-y | repeat | no-repeat)
background-position (top | bottom | left | right | center)
background-attachment (scroll | fixed)
background-clip (margin | border | padding | content)
background-origin (margin | border | padding | content)//color:
color
gridline-color
selection-color //border:
border
border-top
border-right
border-bottom
border-leftborder-color
border-top-color
border-right-color
border-bottom-color
border-left-colorborder-image border-radius
border-top-left-radius
border-top-right-radius
border-bottom-right-radius
border-bottom-left-radiusborder-style (dashed | dot-dash | dot-dot-dash | dotted | double | groove | inset | outset | ridge | solid | none)
border-top-style
border-right-style
border-bottom-style
border-left-styleborder-width
border-top-width
border-right-width
border-bottom-width
border-left-width//font:
font
font-family
font-size
font-style (normal | italic | oblique)
font-weight (normal | bold | 100 | 200 ... | 900)//margin:
margin
margin-top
margin-right
margin-bottom
margin-left//padding:
padding
padding-top
padding-right
padding-bottom
padding-left//outline:
outline
outline-color
outline-offset
outline-style
outline-radius
outline-bottom-left-radius
outline-bottom-right-radius
outline-top-left-radius
outline-top-right-radius//others
width
height
max-height
max-width
min-height
min-width
image (url(filename))
image-position
show-decoration-selected (Boolean:Controls whether selections in a QListView cover the entire row or just the extent of the text.)
opacity (0 (transparent) to 255 (opaque))
subcontrol-origin (margin | border | padding | content)
subcontrol-position
text-align
text-decoration (none, underline, overline, line-through)
position (relative | absolute)
top
right
bottom
left button-layout
icon-size
spacing
dialogbuttonbox-buttons-have-icons
lineedit-password-character
lineedit-password-mask-delay
messagebox-text-interaction-flags
paint-alternating-row-colors-for-empty-area
titlebar-show-tooltips-on-buttons}
widget-animation-duration* (This property was added in Qt 5.10)
- 伪类选择器
:active
:adjoins-item
:alternate
:bottom
:checked
:closable
:closed
:default
:disabled
:editable
:edit-focus
:enabled
:exclusive
:first
:flat
:floatable
:focus
:has-children
:has-siblings
:horizontal
:hover
:indeterminate
:last
:left
:maximized
:middle
:minimized
:movable
:no-frame
:non-exclusive
:off
:on
:only-one
:open
:next-selected
:pressed
:previous-selected
:read-only
:right
:selected
:top
:unchecked
:vertical
:window
- subcontrol选择器
::add-line
::add-page
::branch
::chunk
::close-button
::corner
::down-arrow
::down-button
::drop-down
::float-button
::groove
::indicator
::handle
::icon
::item
::left-arrow
::left-corner
::menu-arrow
::menu-button
::menu-indicator
::right-arrow
::pane
::right-corner
::scroller
::section
::separator
::sub-line
::sub-page
::tab
::tab-bar
::tear
::tearoff
::text
::title
::up-arrow
::up-button
这篇关于Qt总结之QSS的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!