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);