如何在Qt中设置QTableWidget背景透明?

如何在Qt中设置QTableWidget背景透明?,qt,background,transparency,qtablewidget,Qt,Background,Transparency,Qtablewidget,我正在开发一个应用程序,我在其中使用QTableWidgets,我需要将其背景设置为透明,我已经尝试从表单中setStyleSheet“background:transparent;”,但什么都没有发生,还有其他方法吗?我正在发布一个截图 你走在正确的轨道上。尝试: setStyleSheet("QTableWidget {background-color: transparent;}" "QHeaderView::section {background-color:

我正在开发一个应用程序,我在其中使用QTableWidgets,我需要将其背景设置为透明,我已经尝试从表单中
setStyleSheet“background:transparent;”
,但什么都没有发生,还有其他方法吗?我正在发布一个截图


你走在正确的轨道上。尝试:

setStyleSheet("QTableWidget {background-color: transparent;}"
              "QHeaderView::section {background-color: transparent;}"
              "QHeaderView {background-color: transparent;}"
              "QTableCornerButton::section {background-color: transparent;}");
QTableWidget *table = new QTableWidget(latticeView);
table->setRowCount(2);
table->setColumnCount(2);
注意,我在创建表格小部件之前设置了样式表。我不知道为什么,但这似乎是必要的