Creating a Double Scrollbar
-
Hello! I'm using a tool which changes my system-wide Qt theme (qt6ct), which is also capable of using the Qt Style Sheets.
I am a big fan of the "double scrollbar" style which can be used within Haiku (the scrollbar style beneath the one outlined in blue):
My question is whether or not I can replicate this type of scrollbar style using Style Sheets alone. So far, I have only found configuration examples which change the shape and/or color of those add-line and sub-line buttons.
I have added an example Style Sheet below. Attempting to add two subcontrol entries simply causes the bottom one to override the first one, it seems.
QScrollBar::sub-line:vertical { background: magenta; height: 16px; subcontrol-position: top; subcontrol-origin: margin; border: 2px solid black; } QScrollBar::sub-line:vertical { background: magenta; height: 16px; subcontrol-position: bottom; subcontrol-origin: margin; border: 2px solid black; position: absolute; bottom: 20px; }
Any help would be appreciated!
(Qt Ver. 6.8.3 on Gentoo Linux.) -
Please provide a minimal compilable reproducer as described here.
-
Please provide a minimal compilable reproducer as described here.
@Axel-Spoerl, forgive me. I noticed the example I've provided wasn't enough to replicate the issue. I have added a new one below which changes the vertical scrollbar.
The two "sub-line" parts should demonstrate the issue I'm trying to explain in regard to a vertical scrollbar. The sub-line at the bottom of the code (with a blue background) causes a blue button to appear below the scrollbar. Making it to where the sub-line with a magenta background is at the bottom of the code instead simply overrides the blue one, causing the blue button to not appear.
QScrollBar:vertical { border: 2px solid green; background: cyan; width: 15px; margin: 20px 0px 40px 0px; } QScrollBar::add-line:vertical { background: gray; height: 16px; subcontrol-position: bottom; subcontrol-origin: margin; border: 2px solid black; } QScrollBar::sub-line:vertical { background: magenta; height: 16px; subcontrol-position: bottom; subcontrol-origin: margin; border: 2px solid black; position: absolute; bottom: 20px; } QScrollBar::sub-line:vertical { background: blue; height: 16px; subcontrol-position: top; subcontrol-origin: margin; border: 2px solid black; }
Although it may not be possible, I'm wondering if both the blue and magenta scrollbar buttons can exist simultaneously.
-
Hi @traev,
I think we are misunderstanding each other.
A style sheet is posted, but we actually need a very small program to reproduce the issue, i.e. creating the UI attached. The link I posted above leads to a guideline on how to report bugs and reproducers. Please read the section "Attachment / Reproducer". In a nutshell: Please make it short and sweet. No ui files, no subclassing, just the bare minimum to reproduce the issue.
Jusr by looking at the style sheet, nobody can tell you what is wrong. -
It's not possible with Qt at all since the styles don't support more than one 'action rect' for a subcontrol.
-
It's not possible with Qt at all since the styles don't support more than one 'action rect' for a subcontrol.
@Christian-Ehrlicher, thanks for the explanation. That is totally fine; I was just wondering if I could create a style similar to it, since most of my desktop is made up of Qt widgets and programs, but a single add-line and sub-line will still do, of course.
Thank you both nonetheless. -
T traev has marked this topic as solved