【问题标题】:How to set QTableWidget background transparent in Qt?如何在 Qt 中设置 QTableWidget 背景透明?
【发布时间】:2012-05-06 01:10:09
【问题描述】:

我正在开发一个使用 QTableWidgets 的应用程序,我需要将其背景设置为透明,我曾尝试从表单中 setStyleSheet "background:transparent;",但没有任何反应,还有其他方法吗?我发截图

【问题讨论】:

    标签: qt background transparency qtablewidget


    【解决方案1】:

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

    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);
    

    请注意,我在创建表格小部件之前设置样式表。我不知道为什么,但这似乎是必要的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-27
      • 2018-12-25
      • 2016-10-09
      • 1970-01-01
      • 2011-06-05
      • 2011-02-02
      • 2011-10-04
      • 2017-03-08
      相关资源
      最近更新 更多