QTableWidget* tableWidget = new QTableWidget(this);
tableWidget->horizontalHeader()->setStyleSheet("QHeaderView::section, QTableCornerButton::section {
padding: 1px;border: none;
border-bottom: 1px solid rgb(75, 120, 154);
border-right: 1px solid rgb(75, 120, 154);
border-bottom: 1px solid gray;
background-color:rgba(75, 120, 154,1);
color:rgb(126,206,244);}")
同样可以通过ui来设置styleSheet
通过styleSheet设置QComboBox
QComboBox* comboBox = new QComboBox(); //新建下拉选择框控件
comboBox->setStyleSheet("QComboBox{border:1px solid gray;} \
QComboBox QAbstractItemView::item{height:20px;}\
QComboBox::down-arrow{image:url(:/icon/arrowdown);}\
QComboBox::drop-down{border:0px;}");
comboBox->setView(new QListView());