Hi everyone! I subclassed a QSlider to create one which reacts to mousePressEvent and mouseReleaseEvent. Seemed to work quite well till I added the capability for the user to change the slider position by just clicking the slider in some place.

I searched the forums and I implemented this by adding in mousePressEvent the line:

Qt Code:
  1. setValue(QStyle::sliderValueFromPosition(minimum(), maximum(), event->x(), width(), 0));
To copy to clipboard, switch view to plain text mode 

This seems to correctly place the handle of the slider, after that mouseReleaseEvent is called correctly, but it seems the signal mouseReleaseEvent is not. This is my mouseReleaseEvent method:

Qt Code:
  1. void SliderProgressIndicator::mouseReleaseEvent(QMouseEvent* event) {
  2. // Do whatever you do usually.
  3. QSlider::mouseReleaseEvent(event);
  4.  
  5. // Do some other stuff...
  6. }
To copy to clipboard, switch view to plain text mode 

mouseReleaseEvent seems to be called (placed a breakpoint and it's ok), but the singal seems not to be sent. The signal is instead sent when I drag the handle. Any idea why?

I could simply emit it manually, but in the case of the drag I would get the signal is emitted twice...

Thanks!