当前位置:网站首页>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;
}
边栏推荐
- Leetcode刷题---832
- Praise syllogism
- Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ not supported
- Unity学习笔记:个人学习项目《疯狂天才埃德加》纠错文档
- 8、 Transaction control language of MySQL
- 深度学习入门之自动求导(Pytorch)
- 权重衰退(PyTorch)
- Preliminary knowledge of Neural Network Introduction (pytorch)
- If you always feel that you need to persist in learning English
- Leetcode skimming ---75
猜你喜欢

Ind wks first week

Ut2015 learning notes

Numpy quick start (II) -- Introduction to array (creation of array + basic operation of array)

Unity learning notes: personal learning project "crazy genius Edgar" error correction document

缓存路由组件

大型电商项目-环境搭建

The imitation of jd.com e-commerce project is coming

UI interface design related knowledge (I)

6、 Data definition language of MySQL (1)

Drop out (pytoch)
随机推荐
Flink--自定义函数
MySql 怎么查出符合条件的最新的数据行?
[combinatorial mathematics] pigeon's nest principle (simple form of pigeon's nest principle | simple form examples of pigeon's nest principle 1, 2, 3)
Leetcode skimming ---202
Ind kwf first week
Leetcode skimming ---367
[untitled]
Adaptive Propagation Graph Convolutional Network
Numpy quick start (V) -- Linear Algebra
Automatic derivation of introduction to deep learning (pytoch)
Chiyou (), a specific mythical image, is also gradually abstracted as a dramatic character type "Jing". "Jing", born in Dan Dynasty and ugly at the end, is the earliest "profession" in Chinese drama
小文件专项
Convolutional neural network (CNN) learning notes (own understanding + own code) - deep learning
Leetcode skimming ---189
Leetcode skimming ---35
Leetcode skimming ---1
Buy health products for parents
Multilayer perceptron (pytorch)
If you always feel that you need to persist in learning English
一个30岁的测试员无比挣扎的故事,连躺平都是奢望