当前位置:网站首页>Qt:qss custom QSlider instance
Qt:qss custom QSlider instance
2022-07-03 10:53:00 【C and c++ technology blog】
QT:QSS Customize QSlider example
You can set the style of the horizontal slider , As shown below :
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;
}
If you want to change the color of the slider parts before and after the handle , You can use add page and sub page sub controls . for example , For vertical sliders :
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 skimming ---367
What happened to those who focused on automated testing?
QT:QSS自定义 QTabWidget 和 QTabBar实例
如何在游戏中制作一个血条
测试理论概述
Bid -- service commitment -- self summary
Programming examples of stm32f1 and stm32subeide -tm1637 drives 4-bit 7-segment nixie tubes
QT:QSS自定义 QTreeView实例
Unity learning notes: personal learning project "crazy genius Edgar" error correction document
[SQL] an article takes you to master the operations related to query and modification of SQL database
随机推荐
QT:QSS自定义 QSplitter实例
你真的需要自动化测试吗?
Basic usage of sqlmap
最高月薪18K 拥有好的“心态和选择”, 成功就差“认真和坚持”~
软件测试必学基本理论知识——APP测试
What happened to those who focused on automated testing?
DAY 7 小练习
QT:QSS自定义QHeaderView实例
Leetcode skimming ---1385
分组函数之rollup、cube函数、grouping sets函数
A detailed explanation of vector derivative and matrix derivative
Buy health products for parents
Numpy quick start (V) -- Linear Algebra
Leaders always entrust the work to flattering employees
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
《通信软件开发与应用》
有些能力,是工作中学不来的,看看这篇超过90%同行
Small file special
文件上传下载测试点
[roast & brain hole] Some Thoughts on the bullet screen interactive game of Wei Shu Wu Three Kingdoms when visiting station B