pyqt5控件QSS记录

本文介绍了PyQT5中QSS(Qt StyleSheet)的使用,展示了如何为QPushButton、QTabWidget和QGroupBox设置不同的状态样式,如:hover、:pressed等,详细定义了背景色、边框、内边距等属性,帮助提升GUI界面的视觉效果。

1. QPushButton

QPushButton:hover
{
    background-color:rgb(44 , 137 , 255);
border-radius:5px;
}

QPushButton:pressed
{
    background-color:rgb(14 , 135 , 228);
    padding-left:3px;
    padding-top:3px;
}

2. QTabWidget

QTabWidget::pane { /*内容区域*/
background-color: rgb(80, 80, 80);/*背景色-空隙颜色*/
border:1px solid rgb(128, 128, 128);
}
QTabBar::tab{/*页签*/
font-size:18px;
min-height:28px;
width:120px;
color: rgb(230, 230, 230);
margin-right:1px;
margin-bottom:1px;
border-top-left-radius:16px 24px;
border:1px solid rgb(128, 128, 128);
border-bottom:0;

3. QGroupBox

QGroupBox {
border: 2px solid rgb(255, 170, 127);
border-radius: 5px;
margin-top: 2ex; 
background-color:rgb(255, 170, 127)
}
QGroupBox::title {
min-height:28px;

subcontrol-origin: margin;
subcontrol-position: top center;
border-radius: 5px;
padding: 0 3px;
background-color:rgb(255, 170, 127)
}

参考:https://github.com/GTRONICK/QSS

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值