我的Qt应用程序中有一个标签小部件,我用CSS为自己设计了它。
这就是它的样子:
1。选定的选项卡,2。悬停选项卡,3。非活动(未选中)选项卡
但是当我将鼠标悬停在已选择的标签上(在这种情况下'创建测验')时,它会被悬停效果取代(我忘了使用黑色字体颜色)我不会希望用户可以悬停在选定的选项卡上。 '创建测验'应该保持绿色,即使你将鼠标悬停在它上面。但我也不想丢弃悬停效果,因为它很有用。
CSS:
QTabBar::tab{
background-color: rgba(255, 255, 255, 94);
border-top-left-radius: 4px;
border-top-right-radius: 4px;
min-width: 8px;
padding: 10px;
margin-left: 3px;
margin-top: 4px;
margin-bottom: 2px;}
QTabBar::tab:selected {
color: rgb(255, 255, 255);
background-color: rgb(11, 154, 111);
}
QTabBar::tab:hover {
background-color: rgba(204, 204, 204, 178);
}
有什么建议吗?
答案 0 :(得分:2)
再添加一个部分:
QTabBar::tab:selected:hover {
color: rgb(255, 255, 255);
background-color: rgb(11, 154, 111);
}
然后selcted + hover也会变绿。 (或者你可以自定义)