【发布时间】:2016-01-22 19:24:23
【问题描述】:
我的 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);
}
有什么建议吗?
【问题讨论】: