scrollbar stylesheet
-------------------------------------------
this->scrollBarWidgets(Qt::AlignBottom);
this->scrollBarWidgets(Qt::AlignRight);
this->verticalScrollBar()->setStyleSheet("QScrollBar:vertical"
"{"
"width:8px;"
"background:rgba(0,0,0,0%);"
"margin:0px,10px,0px,10px;"
"padding-top:2px;"
"padding-bottom:2px;"
"}"
"QScrollBar::handle:vertical"
"{"
"width:8px;"
"background:rgba(0,0,0,25%);"
" border-radius:3px;"
"min-height:50;"
"}"
"QScrollBar::handle:vertical:hover"
"{"
"width:8px;"
"background:rgba(0,0,0,50%);"
" border-radius:3px;"
"min-height:50;"
"}"
"QScrollBar::add-line:vertical"
"{"
"height:0px;width:8px;"
"subcontrol-position:bottom;"
"}"
"QScrollBar::sub-line:vertical"
"{"
"height:0px;width:8px;"
"subcontrol-position:top;"
"}"
"QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical"
"{"
"background:rgba(0,0,0,10%);"
"border-radius:3px;"
"}"
);
this->horizontalScrollBar()->setStyleSheet("QScrollBar:horizontal"
"{"
"height:8px;"
"background:rgba(0,0,0,0%);"
"padding-right:2px;"
"padding-left:2px;"
"}"
"QScrollBar::handle:horizontal"
"{"
"height:8px;"
"background:rgba(0,0,0,25%);"
" border-radius:3px;"
"min-width:50;"
"}"
"QScrollBar::handle:horizontal:hover"
"{"
"height:8px;"
"background:rgba(0,0,0,50%);"
" border-radius:3px;"
"min-width:50;"
"}"
"QScrollBar::add-line:horizontal"
"{"
"width:0px;height:8px;"
"subcontrol-position:right;"
"}"
"QScrollBar::sub-line:horizontal"
"{"
"width:0px;height:8px;"
"subcontrol-position:left;"
"}"
"QScrollBar::add-page:horizontal,QScrollBar::sub-page:horizontal"
"{"
"background:rgba(0,0,0,10%);"
"border-radius:3px;"
"}"
);--------------------------------------------
treeview stylesheet
--------------------------------------------
m_treeView->setStyleSheet( QString("QTreeView{ border-image:url(%1/images/ID_DM_LEFT_BG.png);padding-left:%5px;padding-top:%5px;color:rgb(15,108,181);font-size:%4px;}\
QTreeView{show-decoration-selected:1;}\
QTreeView::item{margin:%2px;height:%3px;}\
QTreeView::item:selected{color:rgb(15,108,181);border-image:url(%1/images/ID_DM_TREEITEM_ACTIVED.png);}\
QTreeView::item:has-children {color:rgb(15,108,181);}\
QTreeView::item:!has-children {color:rgb(15,108,181);}\
QTreeView::branch{background:rgb(242,242,242);}\
QTreeView::branch:has-siblings:adjoins-item {border-image:url(%1/images/ID_DM_TREEITEM_BRANCHMORE.png) 0;}\
QTreeView::branch:!has-children:!has-siblings:adjoins-item {border-image:url(%1/images/ID_DM_TREEITEM_BRANCHEND.png) 0;}\
QTreeView::branch:closed:has-children{border-image:none;image:url(%1/images/ID_DM_TREEITEM_FOLD.png);}\
QTreeView::branch:open:has-children{border-image:none;image:url(%1/images/ID_DM_TREEITEM_UNFOLD.png);}\
").arg(wsImagePath).arg(13*gRatioH).arg(25*gRatioV).arg(12*gRatioH).arg(2*gRatioH));
//m_treeView->header()->setStyleSheet( "QHeaderView{ background-color:#585858 ; color:rgb(201,204,217);font-size:30px}" );
m_treeView->header()->setStyleSheet( QString("QHeaderView{ background-color:#F2F2F2; color:rgb(15,108,181);font:bold;font-size:%1px;}").arg(18*gRatioH));
--------------------------------------------
QStringtempStyle=QString("QTreeView{\
border:0px solid dfdfdf;\
color:#f2f2f2;\
outline: none;\
show-decoration-selected: 1\
}\
QTreeView::item{\
height:20px;\
color:#333333;font-size:12px;font-family:'微软雅黑';\
}\
QTreeView::item:selected{\
background: #f2f2f2;\
}\
QTreeView::branch{\
image:none;\
background: #f2f2f2;\
}\
QTreeView::branch:open:has-children:!has-siblings, \
QTreeView::branch:open:has-children:has-siblings {\
background: #f2f2f2;\
}\
QTreeView::branch:open:has-children:!has-siblings:selected, \
QTreeView::branch:open:has-children:has-siblings:selected {\
background: #f2f2f2;\
}\
QTreeView::branch:has-children:!has-siblings:closed, \
QTreeView::branch:closed:has-children:has-siblings {\
background: #f2f2f2;\
}\
QTreeView::branch:has-children:!has-siblings:closed:selected, \
QTreeView::branch:closed:has-children:has-siblings:selected {\
background: #f2f2f2;\
}\
");
m_treeWidget->setStyleSheet(tempStyle);
treeveiw去掉虚线框
m_treeWidget->setStyleSheet("QTreeView::item{height:32px;font:bold;font-size:24px}");
m_treeWidget->setRootIsDecorated( false ); //remove dotted line border frame
m_treeWidget->setFrameStyle(QFrame::NoFrame); //remove border frame
m_treeWidget->setStyleSheet("QTreeView::branch {image:none;}"); //remove children's dotted line border frame
treeveiw
QStringstrOpenIconPath=QApplication::applicationDirPath()+"/plugin/resource/images/16X16.png";
QString strCloseIconPath = QApplication::applicationDirPath() + "/plugin/resource/images/16X16.png";
QString strOpenSelIconPath = QApplication::applicationDirPath() +"/plugin/resource/images/16X16.png";
QString strCloseSelIconPath = QApplication::applicationDirPath() + "/plugin/resource/images/16X16.png";
QString tempStyle = QString("QTreeView{\
border:0px solid gray;\
color:gray;\
outline: none;\
show-decoration-selected: 1\
}\
QTreeView::item{\
height:20px;\
color:#333333;font-size:12px;font-family:'微软雅黑';\
}\
QTreeView::item:selected{\
background: #41b700;\
}\
QTreeView::branch{\
image:none;\
background: white;\
}\
QTreeView::branch:open:has-children:!has-siblings, \
QTreeView::branch:open:has-children:has-siblings {\
background: white;\
image: url(%1);\
}\
QTreeView::branch:open:has-children:!has-siblings:selected, \
QTreeView::branch:open:has-children:has-siblings:selected {\
background: #41b700;\
image: url(%3);\
}\
QTreeView::branch:has-children:!has-siblings:closed, \
QTreeView::branch:closed:has-children:has-siblings {\
background: white;\
image: url(%2);\
}\
QTreeView::branch:has-children:!has-siblings:closed:selected, \
QTreeView::branch:closed:has-children:has-siblings:selected {\
background: #41b700;\
image: url(%4);\
}\
").arg(strOpenIconPath).arg(strCloseIconPath).arg(strOpenSelIconPath).arg(strCloseSelIconPath);
m_pTreeWidget->setDirViewStyleSheet(tempStyle);
m_pTreeWidget->setObjectName("userTreeWidget");
m_pTreeWidget->setStyleSheet(QString("QWidget#%1{border:1px solid gray;border-right:0px solid gray;border-bottom:0px solid gray;}")\
.arg(m_pTreeWidget->objectName()));