类名样式 | 描述 | example |
---|---|---|
QPushButton { color: red } | 对类QPushButton及其子类颜色设为红色 | QPushButton { color: red } |
.QPushButton | 匹配所有QPushButton但不包含其子类 | .QPushButton { color: red } |
QPushButton#btn | 匹配QPushButton下对象为btn的控件 | QPushButton#btn{color:red} |
QPushButton[enable=true] | 匹配QPushButton属性 | QPushButton[enable=true]{color:red} |
关键字 | 描述 | example |
font | 字体 | font: 15px "Segoe UI"; /* 字体:大小 名称 */ |
background | 背景颜色、背景图像、背景重复和/或背景位置 | QTextEdit { background: yellow } |
background-color | 背景色 | QLineEdit { background-color: rgb(255, 0, 0) } |
background-image | 背景图片 | QFrame { background-image: url(:/images/hydro.png) } |
background-repeat | 属性设置是否及如何重复背景图像 | QFrame { background: white url(:/images/ring.png); background-repeat: repeat-y; } |
alternate-background-color | 交替背景色(表格) | QTreeView { alternate-background-color: blue; background: yellow; } |
background-position | 属性设置背景图像的起始位置 | QFrame {background: url(:/images/footer.png); background-position: bottom left; } |
background-attachment | 属性设置背景图像是否固定或者随着页面的其余部分滚动 | QTextEdit { background-image: url("leaves.png"); background-attachment: fixed; } |
background-clip | 此属性指定剪裁背景颜色和背景图像的矩形 | QFrame {background-image: url(:/images/header.png); background-position: top left;background-origin: content;background-clip: padding; } |
background-origin | 背景相对的位置 | QFrame { background-image: url(:/images/header.png); background-position: top left; background-origin: content; } |
border | 边框设置 border-color, border-style, and/or border-width. | QLineEdit { border: 1px solid white } |
border-top | 上边框 border-top-color, border-top-style, and/or border-top-width. | QLineEdit { border-width: 1px; border-style: solid; border-color: white; } |
border-right | 右边框 border-right-color, border-right-style, and/or border-right-width. | 同上 |
border-left | 左边框 border-left-color, border-left-style, and/or border-left-width. | 同上 |
border-botton | 下边框 border-bottom-color, border-bottom-style, and/or border-bottom-width. | 同上 |
border-color | 边框颜色 | 同上 |
border-image | 用于填充边界的图像。图像被切成九个部分,必要时适当拉伸 | |
border-radius | 圆角变框( border-top-left-radius, border-top-right-radius, border-bottom-right-radius, and border-bottom-left-radius. ) | QLineEdit { border-width: 1px; border-style: solid; border-radius: 4px; } |