I have some horizontal QSliders in my Qt application with 4-5 ticks marks. How can I add QLabels above the slider ticks to reflect the value at each of the ticks?
I suspect the best way to do this is to create a subclass of QSlider and override the paintEvent() method like this answer describes. But how would I add QLabels based on the position of the ticks?
For clarification:
I am looking for Text labels at each tick, ie if I have a slider that goes from 0 - 100 with 4 ticks, the ticks would have "0", "25", "50", and "100" above them, respectively. Your solution is still helpful, I believe I should be able to rework it using this->geometry to get the coordinates and dividing by # of ticks (which I believe I can calculate with (max - min/tick interval)