just a note in case someone stumbles across this:
using the widget _width_ as _span_ parameter in QStyle::sliderValueFromPosition() is probably not going to return correct values.
for example in a horizontal slider the handle has a particular width, thus the end positions for the min/max values are reduced at least by half the width of the handle - that's just why the parameter is actually called span - as it needs to reflect the space that is available for sliding the handle center, not the total width of the slider widget (of course the handle needs to fit within the total width of the widget when set to min/max).
it is also possible for a style/proxy style to change this "sliding span" further by modifying pixel metric values, thus this also might need to be accounted, and since this method is static it of course can't know about all the stuff like the current style handle width/height and/or pixel metrics (if you look at the sources of QStyle, this method does just some simple math, that doesn't deal with the actual geometry of the slider).
Bookmarks