1.设置按钮背景透明
setStyleSheet("QPushButton{background-color: rgba(18, 62, 111, 200);color:rgb(230, 230, 230);}");
设置透明度可以调整rgba最后一个数据的值,其取值范围为(0~255),255为不透明,0为完全透明。
这样设置对窗口中所有QPushButton都生效,如果只想设置某个按钮的样式,要加上这个按钮的objectName,
setStyleSheet("QPushButton#objectName{background-color: rgba(18, 62, 111, 200);color:rgb(230, 230, 230);}");
2.取消按钮选中时的框框
setStyleSheet("QPushButton:focus {outline: none;}");
3.设置按钮为圆角矩形
setStyleSheet("QPushButton{border-radius:10px;}");
更多样式:http://doc.qt.io/qt-5/stylesheet-reference.html