背景图居中,不重复,不拉伸
可以设置背景颜色,颜色上面是背景图片
QPushButton#main_btn_left{
max-width: 10px;
max-height: 68px;
border: 1px solid #0040b0;
background-image: url(:/icon/main_left.png);
background-position:center;
background-repeat:no-repeat;
background-color: #0040b0;
}
QPushButton#main_btn_left:hover{
border: 1px solid #0040b0;
background-color: #0050c3;
}
svg图片直接使用,但是不能切图
QCheckBox#check_12_test{
spacing: 5px;
}
QCheckBox#check_12_test::indicator{
width: 15px;
height: 15px;
}
QCheckBox#check_12_test::indicator:unchecked{
image:url(:/btn/uncheck.svg);
}
QCheckBox#check_12_test::indicator:checked{
image:url(:/btn/checked.svg);
}
QCheckBox#check_12_test::indicator:checked:disabled{
image:url(:/CheckBox/res/checked_disabled.svg);
}
按宽度裁剪图片
QPushButton#btn_close{
max-width: 32px;
max-height: 32px;
border-image: url(:/title/close.png) 0 0 0 0 repeat;
}
QPushButton#common_close:hover{
border-image: url(:/title/close.png) 0 0 0 32 repeat;
}
QPushButton#common_close:pressed{
border-image: url(:/title/close.png) 0 0 0 64 repeat;
}
QPushButton#common_close:disabled{
border-image: url(:/title/close.png) 0 0 0 96 repeat;
}
下面来自网上
QLabel#customLabel {
qproperty-minimumSize: 100px 100px;
qproperty-maximumSize: 100px 100px;
qproperty-pixmap: url(:/Images/logo);
qproperty-scaledContents: true;
}
QPushButton#customButton {
qproperty-text: "Click Me";
qproperty-icon: url(:/Images/logo);
qproperty-iconSize: 20px 20px;
}
QGroupBox#customGroupBox {
qproperty-title: "GroupBox";
}