跳至主要內容

20.QT样式属性

约 263 字小于 1 分钟

选择器

类型选择器:QPushButton 选择所有QPushButton控件。
ID选择器:#myButton 选择ID为myButton的控件。
类选择器:.myClass 选择所有具有myClass类的控件。
属性选择器:[enabled="false"] 选择所有enabled属性为false的控件。
伪类选择器:QPushButton:hover 选择鼠标悬停在上面的QPushButton控件。

状态选择器

: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

背景

background-color:  #RRGGBB、rgb(r, g, b)、颜色名称
background-image: url(:/images/background.png); 

background-repeat: (x,y)
background-position:
background-attachment
background-clip
background-origin

边框

border
border-top
border-right
border-bottom
border-left

border-color: #0000ff;
border-width: 2px;
border-style: none、solid、dotted、dashed   虚线....


字体与文本

color: #00ff00;
font-family: Arial;
font-size: 14px;
font-weight: normal、bold、bolder、lighter
font-style: normal、italic、oblique

边距与填充

margin: 10px;
padding: 5px;



其他常见属性

width: 200px; 
height: 100px;
border-radius: 10px; 
opacity: 0.5;