QTableWidget 设置表头颜色
生活随笔
收集整理的这篇文章主要介绍了
QTableWidget 设置表头颜色
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
QTableWidget 设置表头颜色
方法1:
setStyleSheet( "QHeaderView::section {background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #00007f, stop: 0.5 #00007f,stop: 0.6 #00007f, stop:1 #00007f);color: white;}");方法2:
setStyleSheet("QTableWidget{ color:black; \background-color:rgb(224,224,224);\selection-color:rgb(0, 0, 0); \selection-background-color:rgb( 100,149,237);\border:0px;\font: 8pt 'Microsoft YaHei' ;}""QHeaderView::section:horizontal{ /*设置标题(水平的)*/\border: 1px solid rgb(255, 255, 255); /*白色间隔*/\border - bottom: 0px;/*下边框不需要颜色*/\color: rgb(2, 65, 132);\background: transparent;\padding - left: 2px;\min - width:60px;}");以下方法尝试无效果
ui->tableWidget->horizontalHeader()->setStyleSheet("QHeaderView::section{background:skyblue;}");总结
以上是生活随笔为你收集整理的QTableWidget 设置表头颜色的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: kswapd线程的前世今生
- 下一篇: C++11新特性——总结