分享

QSlider

 QomoIT 2014-09-15

       QSlider是Qt中常用的控件,样式也各种各样,自己尝试做的一个样式,尽管handle能用图片做的更完美,不用图片,视觉效果上,仍然没什么问题,round handle

1、渐变在右上角

  1. QSlider  
  2. {  
  3.     background-color: #ff00ff;   
  4.     border-style: outset;   
  5.     border-radius: 10px;   
  6. }  
  7.   
  8. QSlider::groove:horizontal  
  9. {  
  10.     height: 12px;  
  11.     background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #B1B1B1, stop:1 #c4c4c4);  
  12.     margin: 2px 0  
  13. }  
  14. QSlider::handle:horizontal   
  15. {  
  16.     background: QRadialGradient(cx:0, cy:0, radius: 1, fx:0.5, fy:0.5, stop:0 white, stop:1 green);  
  17.     width: 16px;  
  18.     height: 16px;  
  19.     margin: -5px 6px -5px 6px;  
  20.     border-radius:11px;   
  21.     border: 3px solid #ffffff;  
  22. }  

效果如下图:

round handle

2、渐变在圆形中心

  1. QSlider  
  2. {  
  3.     background-color: #ff00ff;   
  4.     border-style: outset;   
  5.     border-radius: 10px;   
  6. }  
  7.   
  8. QSlider::groove:horizontal  
  9. {  
  10.     height: 12px;  
  11.     background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #B1B1B1, stop:1 #c4c4c4);  
  12.     margin: 2px 0  
  13. }  
  14. QSlider::handle:horizontal   
  15. {  
  16.     background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5, stop:0 white, stop:1 green);  
  17.     width: 16px;  
  18.     height: 16px;  
  19.     margin: -5px 6px -5px 6px;  
  20.     border-radius:11px;   
  21.     border: 3px solid #ffffff;  
  22. }  


    大家有一些好的样式效果,一起学习下。。。。。。有好的想法,可以留言。。




    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多