怎么改变获取到焦点的QLineEdit的颜色,失去焦点后颜色变回

2025-03-26 17:52:18
推荐回答(1个)
回答1:

设置样式:
QLineEdit{
border:1px solid gray;
}
QLineEdit:hover{
border-width:2px;
border-color:rgb(170, 170, 255);
}
QLineEdit:focus {
border-width:2px;
border-color:rgb(170, 170, 255);
}

注意:QLineEdit:focus这是获取焦点的样式!