qss样式化QTableView,QTreeView,QTableWidget
QHeaderView
{
background:transparent;
}
QHeaderView::section
{
font-size:14px;
font-family:"Microsoft YaHei";
color:#FFFFFF;
background:#60669B;
border:none;
text-align:left;
min-height:49px;
max-height:49px;
margin-left:0px;
padding-left:0px;
}
QTableWidget
{
background:#FFFFFF;
border:none;
font-size:12px;
font-family:"Microsoft YaHei";
color:#666666;
}
QTableWidget::item
{
border-bottom:1px solid #EEF1F7 ;
}
QTableWidget::item::selected
{
color:red;
background:#EFF4FF;
}
QScrollBar::handle:vertical
{
background: rgba(255,255,255,20%);
border: 0px solid grey;
border-radius:3px;
width: 8px;
}
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical
{
background:rgba(255,255,255,10%);
}
QScollBar::add-line:vertical, QScrollBar::sub-line:vertical
{
background:transparent;
}
tableWidget->verticalHeader()->setDefaultSectionSize();
tableWidget->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
tableWidget->setFocusPolicy(Qt::NoFocus);
```cpp
QTableView,QTableWidget {
selection-background-color:#44c767;
background-color:white;
border:1px solid #E0DDDC;
gridline-color:lightgray;
}
QHeaderView::section {
background-color:white;
border:0px solid #E0DDDC;
border-bottom:1px solid #E0DDDC;
height:20px;
}
QTableView{
color: rgb(0, 0, 0);
border: 1px solid #C07010;
gridline-color:#C07010;
background-color: rgb(20, 20, 20);
alternate-background-color: rgb(200, 200, 200);
selection-background-color: rgb(130, 190, 100);
}
QTableView::item:!alternate:!selected{
background-color: rgb(220, 220, 220);
}
QToolButton{
min-width:80px;
min-height:32px;
}
QToolButton{
color:rgb(255, 255, 255);
min-height:20;
border-style:solid;
border-top-left-radius:2px;
border-top-right-radius:2px;
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 rgb(226,236,241),
stop: 0.3 rgb(160,160,160),
stop: 1 rgb(140,140,140));
border:1px;
border-radius:5px;padding:2px 4px;
}
QToolButton:hover{
color:rgb(255, 255, 255);
min-height:20;
border-style:solid;
border-top-left-radius:2px;
border-top-right-radius:2px;
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 rgb(226,236,241),
stop: 0.3 rgb(160,160,160),
stop: 1 rgb(120,120,120));
border:1px;
border-radius:5px;padding:2px 4px;
}
QToolButton:pressed{
color:rgb(255, 255, 255);
min-height:20;
border-style:solid;
border-top-left-radius:2px;
border-top-right-radius:2px;
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 rgb(226,236,241),
stop: 0.3 rgb(190,190,190),
stop: 1 rgb(160,160,160));
border:1px;
border-radius:5px;padding:2px 4px;
}
QToolButton:checked{
color:rgb(255, 255, 255);
min-height:20;
border-style:solid;
border-top-left-radius:2px;
border-top-right-radius:2px;
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 rgb(226,236,241),
stop: 0.3 rgb(190,190,190),
stop: 1 rgb(160,160,160));
border:1px;
border-radius:5px;padding:2px 4px;
}