如何在QT中更改标题边框颜色,文本颜色和背景颜色?

时间:2015-09-28 09:13:30

标签: qt

  

在我的应用程序中我使用tablewidget,它工作正常,但无法更改表格的边框颜色和背景颜色和文本颜色。我想要整个表(包括单元格)的“白色”边框颜色,“黑色”背景颜色和“白色”文本颜色。我试过像

这样的代码
//
tableWidget->item(0,0)->setBackgroundColor(Qt::black);
tableWidget->item(0,0)->setTextColor(Qt::white);
//the above 2 lines works fine , but how to set cell border color as white
QString styleSheet = "::section{" // "QHeaderView::section {""spacing: 10px;""background-color: green;""color:white;""border: 1px solid white;""margin: 1px;""text-align: right;""font-family: arial;" "font-size: 12px; }";
tableWidget->horizontalHeader()->setStyleSheet(styleSheet);
  

我也尝试了样式表,但也没有用。指导我,

0 个答案:

没有答案
相关问题