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线程的前世今生
- 下一篇: Linux文件系统管理-常用命令df\d