• 4879阅读
  • 0回复

[提问]QTabWidget的tab如何在使用qss的同时还能保持triangle的效果 [复制链接]

上一主题 下一主题
离线tangxunmin
 

只看楼主 倒序阅读 楼主  发表于: 2013-04-23
如题:  tab使用了stylesheet



m_tabwidget->setStyleSheet(QString("\
QTabWidget::tab-bar {\
     left: 5px; /* move to the right by 5px */\
}\
\
/* Style the tab using the tab sub-control. Note that\
     it reads QTabBar _not_ QTabWidget */\
QTabBar::tab {\
     background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,\
                                 stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,\
                                 stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);\
     border: 1px solid #C4C4C3;\
     border-bottom-color: #FFFFFE;/*#C2C7CB;  same as the pane color */\
     /*border-top-left-radius: 4px;*/\
    /* border-top-right-radius: 4px;*/\
     min-width: 8ex;\
     /*padding: 2px;*/\
}\
\
QTabBar::tab:selected, QTabBar::tab:hover {\
     background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,\
                                 stop: 0 #fafafa, stop: 0.4 #f4f4f4,\
                                 stop: 0.5 #e7e7e7, stop: 1.0 #fafafa);\
}\
\
QTabBar::tab:selected {\
     border-color: #9B9B9B;\
     border-bottom-color: #FFFFFE; /* same as pane color */\
}\
\
}"));
后,出来效果如图 :




想要三角的效果,即使设置m_tabwidget->setTabShape(QTabWidget::Triangular);也没有效果了
主要想实现如图:这个效果。请教如何设置呢。
快速回复
限100 字节
 
上一个 下一个