November 20, 2011

ptbremer ptbremer
Lab Rat
1 posts

Slider Tickmarks Layout

 

Hello,

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

1 reply

November 21, 2011

Andre Andre
Robot Herder
6393 posts

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.

 
  ‹‹ [SOLVED] Qextserialport issues on Windows!      Boost Exceptions cause a memory violation ››

You must log in to post a reply. Not a member yet? Register here!