How can I disable QSlider's emitting SIGNAL valueChanged on keyboard arrows and mouseWheel scroll. By setting
ui->horizontalSlider->setFocusPolicy(Qt::NoFocus);
the keyboards arrows keys are not emitting signals.
How can I do the same for mouse wheel scroll? I don't want to reimplement my custom Slider class from QSlider. Am asking for any work around or api, so that I can disable the keyboard and mouse wheel scroll responding to qslider.
The main intention is to avoid sending signals on every valueChange. So I have implemented the following and it's working fine
on_horizontalSlider_sliderReleased()
on_horizontalSlider_sliderPressed()
based on bool flag updated in these 2 slots,
on_horizontalSlider_valueChanged(int)
is doing the required operation...like after slider released, value is being added in the required application.
Request to provide approaches, examples for the work around.
You can use EventFilter to block emitting signals ValueChanged from QSlider by wheel rotating. But if you want some special behavior - you need control additional options in you EventFilter. EventFilter can manage many behavior of object without subclassing it.