设置样式: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这是获取焦点的样式!