QT/E中聚焦显示仅仅是一个虚线边框,对于恶劣环境下的机器来说,这样的虚线简直就可以忽略不记.谁看得见这么细的线啊.
所以为了聚焦的控件更好显示.只有将聚焦控件的颜色换成其他颜色来区别.找了很久都没找到合适的方式,我想有很多做QT/E的人有同感吧,现在看了这篇文章你应该感到幸福了.
因为我这种方式只需要几行代码就可以解决这个问题.其实类似的方式网上已经有了,只是写得不是很详细,我这里就提供出来给大家参考下.
QString button_style = "QPushButton:focus{background-color:rgb(85,170,255);}"; //ui->NewBtn->setStyleSheet(button_style); //ui->enterBtn->setStyleSheet(button_style); //ui->delBtn->setStyleSheet(button_style);
//QString button_style = "QPushButton:focus{background-color:rgb(85,170,255);border-style:inset;}"; /*"QPushButton{background-color:black;color:white;border-radius:10px;border:2px groovegray;border-style:outset;}" "QPushButton:hover{background-color:white;color:black;}" "QPushButton:press{background-color:rgb(85,170