当前位置:网站首页>QT:QSS自定义 QSlider实例
QT:QSS自定义 QSlider实例
2022-07-03 09:38:00 【C和C++技术博客】
QT:QSS自定义 QSlider实例
您可以设置水平滑块的样式,如下所示:
QSlider::groove:horizontal {
border: 1px solid #999999;
height: 8px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #B1B1B1, stop:1 #c4c4c4);
margin: 2px 0;
}
QSlider::handle:horizontal {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f);
border: 1px solid #5c5c5c;
width: 18px;
margin: -2px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */
border-radius: 3px;
}
如果要更改手柄前后滑块部件的颜色,可以使用添加页面和子页面子控件。 例如,对于垂直滑块:
QSlider::groove:vertical {
background: red;
position: absolute; /* absolutely position 4px from the left and right of the widget. setting margins on the widget should work too... */
left: 4px; right: 4px;
}
QSlider::handle:vertical {
height: 10px;
background: green;
margin: 0 -4px; /* expand outside the groove */
}
QSlider::add-page:vertical {
background: white;
}
QSlider::sub-page:vertical {
background: pink;
}
边栏推荐
猜你喜欢
An open source OA office automation system
Timo background management system
Ut2016 learning notes
Jetson TX2 brush machine
A complete answer sheet recognition system
Matrix calculation of Neural Network Introduction (pytoch)
深度学习入门之线性回归(PyTorch)
熵值法求权重
[roast & brain hole] Some Thoughts on the bullet screen interactive game of Wei Shu Wu Three Kingdoms when visiting station B
Linear regression of introduction to deep learning (pytorch)
随机推荐
Numpy quick start (V) -- Linear Algebra
Flink <-->JDBC的使用介绍+with参数
神经网络入门之预备知识(PyTorch)
项目组织战略管理
Unity学习笔记:联网游戏Pixel Adventure 1学习过程&纠错心得
Class-Variant Margin Normalized Softmax Loss for Deep Face Recognition
Leetcode刷题---263
Mysql5.7 installation and configuration tutorial (Graphic ultra detailed version)
Traversal of map set
[untitled]
Ind FXL first week
神经网络入门之模型选择(PyTorch)
Jetson TX2 刷机
Leetcode刷题---217
CSDN, I'm coming!
Tensorflow—Image segmentation
A complete mall system
八、MySQL之事务控制语言
如何监测服务器主机的进出流量?
2021-09-22