GUI 综合案例

1、使Form添加背景,而子控件无背景

QWidget#Form{

border-image: url(:/register/images/spring.jpg);

}

2、设置QPushButton的颜色,伪状态

QPushButton{

background-color: rgb(255, 170, 255);

color: rgb(85, 170, 0);        # 设置字体颜色

border-radius:10px          # 设置边框圆角

}

 

QPushButton:hover{

background-color: rgb(255, 170, 0);

}

QPushButton:pressed{

background-color: rgb(0, 255, 127);

}

 

QPushButton:checked{      # 选中,此伪状态需要在属性中将checkable勾选

 background-color: rgb(20, 255, 127);

}

3、选择器

QPushButton#b2{background-color:orange}   # 将QPushButton中名字为b2的按钮设置为背景色为orange

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

原文地址:https://www.cnblogs.com/forhowcar/p/12564721.html