首页 > 其他 > 详细

Qt QSlider美化进度条

时间:2021-05-05 17:48:51      阅读:27      评论:0      收藏:0      [点我收藏+]

Qt QSlider美化进度条

 

slider = new QSlider(Qt::Horizontal, this);
        QString sliderstyle = QString("QSlider::groove:horizontal {                           "
                "     border: 1px solid #999999;                         "
                "     height: 2px;                                     "
                "     margin: 0px 0;                                   "
                "     left: 12px; right: 12px;                           "
                " }                                                 "
                "QSlider::handle:horizontal {                           "
                "     border: 1px solid #5c5c5c;                         "
                " border-image:url(image/off1.png);"
                "     width: 18px;                                     "
                "     margin: -7px -7px -7px -7px;                       "
                " }                                                 "
                "                                                   "
                "QSlider::sub-page:horizontal{                          "
                " background: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(27, 5, 27, 255), stop:0.25 rgba(99, 20, 102, 255), stop:0.5 rgba(154, 30, 158, 255), stop:1 rgba(173, 57, 176, 255));                   "
                "}                                                  "
                "QSlider::add-page:horizontal{                          "
                " background-image:url(image/skin/8.jpg)   "
                "}");
    slider->setStyleSheet(sliderstyle);
    int maxRange = width() - (3 * play->getMySize().width() + 20);
    slider->move(2 * play->getMySize().width() + 10, height() - 30);
    slider->setFixedWidth(maxRange);
    //width: 10px;
    slider->setRange(0, 999);

  

Qt QSlider美化进度条

原文:https://www.cnblogs.com/xushenghai19841013/p/14731456.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!