I set a picture as background in the mainframe and add two widgets on it: a QTableWidget and a QTabWidget.
- I have set the background of
tablewidgetto be transparent bystylesheetin vs2013. The table's background shows the picture I set but thehorizontalheadersection is still white:
TaskInfWidget_->setStyleSheet("QTableWidget{background:transparent;}\
QTableWidget::item{border-top:1px solid grey;border-bottom:none;border-right:none;border-left:none;}\
QHeaderView::section{background:transparent;color:black; font-family:宋体;font-size:15px;font-weight:200;\
border:none;}");
- But when I add a
tablewidgetin atabwidgetand set thestylesheetof thetabwidget, it doesn't work:
QTabWidget *tab_widget=new QTabWidget;
QTableWidget *table = new QTableWidget(10, 1);
tab_widget->addtab(table,"hahaha");
tab_widget>setStyleSheet("QTabWidget::pane{background:transparent}\
QTabBar::tab{background-color:transparent;height:30px;}\
QTabBar::tab:selected{background-color:rgb(55,112,183)}\
QTabBar::tab:hover{color:rgb(235,97,0);}");
table->setStyleSheet("QTableWidget{background:transparent;\
border:3px solid rgb(30,77,135);\
selection-background-color:rgb(30,77,135);}");
I have set QTabWidget::pane{background:transparent} and QTableWidget{background:transparent}, but the background of the tablewidget is still white, not the picture of the mainframe.
This is my first time to ask question here. This question has bothered me several days. Who can tell me the reason?