• 6178阅读
  • 1回复

如何设置TabWidget中tab的颜色?? [复制链接]

上一主题 下一主题
离线icemanpro
 

只看楼主 倒序阅读 楼主  发表于: 2010-03-06
如何设置TabWidget中tab的颜色??
需要将当前的tab与其它的从颜色上区分。应如何写?
离线午小夜

只看该作者 1楼 发表于: 2010-03-06
setStyleSheet("QTabWidget::pane {border-top: 2px solid gray;/*position: absolute;top: -0.5em;*/}"
                        "QTabBar::tab {border: 2px solid gray;border-bottom-color: #C2C7CB;border-top-left-radius: 4px;"
                        "border-top-right-radius: 4px;padding: 2px;min-height:40px;min-width:80px;font-size:20px;font-weight:75;}"
                        "QTabBar::tab:selected{background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0,"
                        "stop: 0 blue, stop: 0.4 white,stop: 0.6 white, stop: 1.0 blue);}"
                        "QTabBar::tab:hover {background: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0,"
                        "stop: 0 lightblue, stop: 0.5 white,stop: 0.6 white, stop: 1.0 lightblue);}"
                        "QTabBar::tab:selected {border-color: #9B9B9B;border-bottom-color: #C2C7CB;}"
                        );
这是我写的一个样式。你自己揣摩。
另外赠送一个链接http://doc.trolltech.com/4.6/stylesheet-reference.html
[ 此帖被午小夜在2010-03-06 21:30重新编辑 ]
[操作系统版本]  Windows XP;Linux Ubuntu;Linux Fedora;
[Qt SDK版本]    4.7.0
[SDK 发布日期]  2010.05
[IDE(集成开发环境)] QtCreator
个人网页:http://hi.baidu.com/午小夜
學歷:Royal Jalidon
快速回复
限100 字节
 
上一个 下一个