参考博客:https://blog.csdn.net/qq_42250189/article/details/105199339
https://blog.csdn.net/weixin_38169769/article/details/99894650
以下内容是摘抄上述博客:
//样例-文字:
btn1->setStyleSheet("QPushButton{color:red;background:yellow}"
"QPushButton::hover{background:rgb(110,115,100);}"
"QPushButton::pressed{background:#eb7350;}");
//样例-图片:
btn1->setStyleSheet("QPushButton{border-image:url(xxx);}"
"QPushButton::hover{border-image:url(xxxx);}"
"QPushButton::pressed{border-image:url(xxx);}");
按钮的几种状态:
css中按钮有四种状态
1. 普通状态
2. hover 鼠标悬停状态
3. active 点击状态
4. focus 取得焦点状态