QTableView表格滾動條樣式(QSS真是細緻到家了)

環境:Qt5.3ui

IDE:QtCreatorurl

效果預覽:spa

 

垂直與水平滾動條樣式.net

代碼:blog

 

[cpp]  view plain copy print ?
 
  1. ui->QTableView->verticalScrollBar()->setStyleSheet("QScrollBar:vertical{"        //垂直滑塊總體  
  2.                                                           "background:#FFFFFF;"  //背景色  
  3.                                                           "padding-top:20px;"    //上預留位置(放置向上箭頭)  
  4.                                                           "padding-bottom:20px;" //下預留位置(放置向下箭頭)  
  5.                                                           "padding-left:3px;"    //左預留位置(美觀)  
  6.                                                           "padding-right:3px;"   //右預留位置(美觀)  
  7.                                                           "border-left:1px solid #d7d7d7;}"//左分割線  
  8.                                                           "QScrollBar::handle:vertical{"//滑塊樣式  
  9.                                                           "background:#dbdbdb;"  //滑塊顏色  
  10.                                                           "border-radius:6px;"   //邊角圓潤  
  11.                                                           "min-height:80px;}"    //滑塊最小高度  
  12.                                                           "QScrollBar::handle:vertical:hover{"//鼠標觸及滑塊樣式  
  13.                                                           "background:#d0d0d0;}" //滑塊顏色  
  14.                                                           "QScrollBar::add-line:vertical{"//向下箭頭樣式  
  15.                                                           "background:url(:/images/resource/images/checkout/down.png) center no-repeat;}"  
  16.                                                           "QScrollBar::sub-line:vertical{"//向上箭頭樣式  
  17.                                                           "background:url(:/images/resource/images/checkout/up.png) center no-repeat;}");  
  18.   
  19. ui->QTableView->horizontalScrollBar()->setStyleSheet("QScrollBar:horizontal{"  
  20.                                                           "background:#FFFFFF;"  
  21.                                                           "padding-top:3px;"  
  22.                                                           "padding-bottom:3px;"  
  23.                                                           "padding-left:20px;"  
  24.                                                           "padding-right:20px;}"  
  25.                                                           "QScrollBar::handle:horizontal{"  
  26.                                                           "background:#dbdbdb;"  
  27.                                                           "border-radius:6px;"  
  28.                                                           "min-width:80px;}"  
  29.                                                           "QScrollBar::handle:horizontal:hover{"  
  30.                                                           "background:#d0d0d0;}"  
  31.                                                           "QScrollBar::add-line:horizontal{"  
  32.                                                           "background:url(:/images/resource/images/checkout/right.png) center no-repeat;}"  
  33.                                                           "QScrollBar::sub-line:horizontal{"  
  34.                                                           "background:url(:/images/resource/images/checkout/left.png) center no-repeat;}");  

http://blog.csdn.net/shihoongbo/article/details/48970515ip

相關文章
相關標籤/搜索