QT小技巧
滑条的美化
美化前
代码如下
//滑条的美化
ui->horizontalSlider->setStyleSheet(
"QSlider::groove:horizontal {"
"border:1px solid skyblue;"
"background-color:skyblue;"
"height:10px;"
"border-radius:5px;"
"}"
"QSlider::handle:horizontal {"
"background:qaradialgradient(spread:pad,cx:0.5,cy:0.5,radius:0.5,fx:0.5,fy:0.5,stop:0.7 white,stop:0.8 rgb(140,212,255));"
"width:20px;"
"border-radius:10px;"
"margin-top:5px;"
"margin-bottom:-5px;}"
"#horizontalSlider::sub-page:horizontal{"
"background:red;"
"margin:10px;"
"border-radius:5px;}"
);
窗口的设计
//禁止使窗口放大
setWindowFlags(windowFlags()&~Qt::WindowMaximizeButtonHint);
//设置窗口大小
setFixedSize(width(),height());
在这里插入图片描述