使用悬停和按下的样式表Qt [英] Using Hover and Pressed stylesheet Qt
本文介绍了使用悬停和按下的样式表Qt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在按钮pushButton样式表中使用了此
I used this in my button pushButton stylesheet
QPushButton#pushButton {
background-color: yellow;
}
QPushButton#pushButton:pressed {
background-color: rgb(224, 0, 0);
}
QPushButton#pushButton:hover {
background-color: rgb(224, 255, 0);
}
当我将鼠标悬停在其上时,它会更改颜色,就像我期望的那样,但是即使按了按钮,悬停颜色仍会保留. 我试图更改顺序,但是仍然存在相同的问题. Qt的新功能.
when I hover my mouse over it, it changes color, like I expect it to , But the hover color remains even when I press the button. I tried changing the order, but its still the same problem . little new in Qt.
推荐答案
您可以组合状态,例如:
You can combine states, for example:
QPushButton:hover:!pressed
{
border: 1px solid red;
}
这篇关于使用悬停和按下的样式表Qt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文