Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Slider Tickmarks Layout
ptbremer last edited by
I am trying to put some simple labels under/over a slider with tickmarks. However, I have some problems of accurately aligning labels to the ticks. In particular, the tickmarks are offset from the two endpoints of the slider. Is there a good (ideally platform independent) way to figure out the position of the first/last tickmark within is widget ? In the default Mac OS 10.6 style it seems both are offset by 9 pixels. I have tried to query things like QStyle::PM_SliderThickness and company but I am either querying the wrong style or these do not have the information I need. I am new to Qt so I am wondering whether there is an easy way to figure this out or whether there are inherent reasons why this should/cannot be easily determined in a general way.
Thanks in advance for any hint
andre last edited by
Good question. I guess this is tricky to do with the standard Qt slider widget. What you might considder (if possible for you), is to use Qwt instead. It provides more options for its slider widget, including having custom scales. It even supports logartitmic scales.