网站制作 客户刁难,天水网站建设公司,拼多多网站怎么建设的,合肥软件公司排名QT开发中#xff0c;需要设置多种多样的控件表现形式#xff0c;QT实现的styleSheet能够满足多种多样的场景#xff0c;这里简单的记录下一些我常用的
设置透明背景#xff0c;鼠标悬浮时#xff0c;设置背景色#xff1a;
pushButton-setStyleSheet(QPushBu…QT开发中需要设置多种多样的控件表现形式QT实现的styleSheet能够满足多种多样的场景这里简单的记录下一些我常用的
设置透明背景鼠标悬浮时设置背景色
pushButton-setStyleSheet(QPushButton {background: transparent;border: none;} QPushButton:hover {background-color: rgba(200, 200, 200, 255);})
//这里设置pushButton的背景正常情况下背景设置为透明当有鼠标悬浮时设置背景色rgba(200, 200, 200, 255)根据控件的property值设置对应的背景 //widget是一个父控件他的子对象可以根据property值设置对应的样式widget-setStyleSheet(*[mandatoryField\true\] { background-color: yellow });child1 widget-findChildQCheckBox*(EditGroupCB);child2 widget-findChildQComboBox*(searchDepthCO);child1-setProperty(mandatoryField,true); // 背景会设置为黄色child2-setProperty(mandatoryField,true); // 背景会设置为黄色QT官方网站关于styleSheet的介绍点击这里