当前位置: 代码迷 >> QT开发 >> 样式表 大神们快来帮忙,该如何解决
  详细解决方案

样式表 大神们快来帮忙,该如何解决

热度:481   发布时间:2016-04-25 03:08:05.0
样式表 大神们快来帮忙


把tablewidgets 做成下面那种样式表  但是好像改不了啊

    ui->tw_test->horizontalHeader()->setStyleSheet(      
                "QHeaderView::section{border:2px groove gray;"
                "border-radius:10px;padding:2px 4px;"
                "background-color: rgb(170, 170, 255);"
                "font: 10pt '华文隶书'}");
这是样式表
------解决思路----------------------
ui->tableWidget->horizontalHeader()->setStyleSheet("QHeaderView::section{color:white;border:none;border-radius:5px;height:23px;margin-left:1px;\
                    background:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 rgba(130, 130, 130, 190),stop:1 rgba(68, 68, 68, 200));}\
         QHeaderView::section:hover{background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6ea1f1, stop: 1 #567dbc);}\
         QHeaderView::section:pressed{background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #fcf300,stop: 1 #ffc000);color:#424242;}");

你试一试这个,在我这里可以设置成功,但是效果你要自己调整下。
------解决思路----------------------
setStyleSheet("QTabWidget::pane{border-width:1px;border-color:rgb(48, 104, 151);\
                                    border-style: outset;background-color: rgb(132, 171, 208);\
                                    background: transparent;} \
QTabWidget::tab-bar{border-width:0px;}\
QTabBar::tab{border-bottom-color: #C2C7CB;\
             border-top-left-radius: 0px;\
             border-top-right-radius: 0px;\
             max-width: 75px; min-width:75px; min-height:25px;\
             font:14px Times New Roman;\
                 padding: 0px;\
                 }\
QTabBar::scroller {\
                   width:25;\
                       border:0;\
                           padding: 0px;\
                           }\
QTabBar QToolButton::right-arrow {\
                                  background-color:rgb(132, 171, 208);\
                                  border-width: 0;\
                                  background-image: url(:/images/tab/rightbtn.png);\
                              }\
QTabBar QToolButton::right-arrow:hover {\
                                        background-color:rgb(132, 171, 208);\
                                        border-width: 0;\
                                        background-image: url(:/images/tab/hoverrightbtn.png);\
                                    }\
QTabBar QToolButton::right-arrow:disabled {\
                                        background-color:rgb(132, 171, 208);\
                                        border-width: 0;\
                                        background-image: url(:/images/tab/grayrightbtn.png);\
                                    }\
QTabBar QToolButton::left-arrow {\
                                 background-color:rgb(132, 171, 208);\
                                 border-width: 0;\
                                 background-image: url(:/images/tab/leftbtn.png);\
                             }\
QTabBar QToolButton::left-arrow:hover {\
                                       background-color:rgb(132, 171, 208);\
                                       border-width: 0;\
                                       background-image: url(:/images/tab/hoverleftbtn.png);\
                                   }\
QTabBar QToolButton::left-arrow:disabled {\
                                       background-color:rgb(132, 171, 208);\
                                       border-width: 0;\
                                       background-image: url(:/images/tab/grayleftbtn.png);\
                                   }\
QTabBar::tab:first:selected {\
                             margin-left: 30; margin-right: 0;\
                             color: white;\
                                 border-image: url(:/images/tab/sel3.png);\
                             }\
QTabBar::tab:first:!selected {\
                              color: black;\
                                  margin-left: 30; margin-right: 0;\
                                  border-image: url(:/images/tab/normal3.png);\
                              }\
QTabBar::tab:first:hover:!selected {\
                                    color: black;\
                                        margin-left: 30; margin-right: 0;\
                                        border-image: url(:/images/tab/hover3.png);\
                                    }\
QTabBar::tab:middle:selected {\
                              margin-top: 0; margin-left: -15; margin-right: 8;\
                              color: white;\
                                  border-image: url(:/images/tab/sel3.png);\
                              }\
QTabBar::tab:middle:!selected {\
                               color: black;\
                                   margin-top: 0; margin-left: -15; margin-right: 8;\
                                   border-image: url(:/images/tab/normal3.png);\
                               }\
QTabBar::tab:middle:hover:!selected {\
                                     color: black;\
                                         margin-top: 0; margin-left: -15; margin-right: 8;\
                                         border-image: url(:/images/tab/hover3.png);\
                                     }\
QTabBar::tab:last:selected {\
                            margin-top: 0px; margin-left: 0; margin-right: 0;\
                            color: white;\
                                border-image: url();\
                            }\
QTabBar::tab:last:!selected {\
                             color: black;\
                                 margin-top: 0; margin-left: 0; margin-right: 0;\
                                 border-image: url();\
                             }\
QTabBar::tab:last:hover:!selected {\
                                   color: black;\
                                       margin-top: 0; margin-left: 0; margin-right: 0;\
                                       border-image: url();\
                                   }\
QTabBar::tab:only-one {\
                       margin: 0;\
                       }");
  相关解决方案