这里是0基础学习的非专业Python小白,以下内容只为记录学习过程,仅供参考
QT desiger-QPushButton用法
利用qss编写QPushButton的简单反馈
1.视觉反弹
ps:通过边框线条改变,就能实现视觉反弹的效果
QPushButton{ border-radius:5px; /*设置边框倒角*/
background-color:rgb(255, 255, 255); /*设置背景色*/
border:2px solid#666666; /*设置按钮四边为实线灰色*/
border-top:none; /*设置顶边为透明色*/
border-left:none;} /*设置左边为透明色*/
QPushButton:pressed{
border:2px solid #666666; /*设置按钮四边为实线灰色*/
border-bottom:none; /*设置底边为透明色*/
border-right:none;} /*设置右边为透明色*/
2.颜色改变
ps:通过改变PushButton颜色达到按钮反馈
QPushButton{
background:white; /*设置背景为白色*/
border-radius:6px;} /*设置边框倒角*/
QPushButton:pressed{
background:rgb(85, 170, 255)} /*设置被按时颜色*/