一个小项目的主菜单用了QTabWidget,一直无法点击其中的tab项,搞了好久,发现是qss惹的祸。不合规的qss编译无误,却导致了QTabWidget tab项无法点击。
贴上错误的qss。我也不知道哪错了,但是去掉qss,QTabWidget tab项可点击。
QString g_menuTab_qss = "QTabWidget::tab-bar{background-color: rgb(210, 210, 225);border-width:3px;left: 100px;width:600px}\
QTabBar::tab{\
background-color: rgb(220, 220, 235);\
width: 120px;\
height: 45px;\
margin-left: 10px;\
margin-bottom:8px;\
border-top-left-radius: 8px;\
border-top-right-radius:8px;\
border-bottom-left-radius: 8px;\
border-bottom-right-radius:8px;\
}\
QTabBar:tab:selected{\
color:white; \
background -color: rgb (250, 210, 225, 50);\
font: 75 13pt \"\345\271\274\345\234\206\"; \
}\
}";