Connecting two sliders manually?
-
@lansing
Well it does have a singleStep property
but you mean ONLY on wheel ?
http://doc.qt.io/qt-5/qabstractslider.html#singleStep-propAs far as i know u have to subclass to get jump on click
https://stackoverflow.com/questions/11132597/qslider-mouse-direct-jump -
@lansing
hmm yes, seems to take 3 ticks regardless.
Its handled herevoid QAbstractSlider::wheelEvent(QWheelEvent * e) { Q_D(QAbstractSlider); e->ignore(); int delta = e->delta(); if (e->inverted()) delta = -delta; if (d->scrollByDelta(e->orientation(), e->modifiers(), delta)) e->accept(); }so maybe it depends on how mwheel is setup.
-
@lansing
hmm yes, seems to take 3 ticks regardless.
Its handled herevoid QAbstractSlider::wheelEvent(QWheelEvent * e) { Q_D(QAbstractSlider); e->ignore(); int delta = e->delta(); if (e->inverted()) delta = -delta; if (d->scrollByDelta(e->orientation(), e->modifiers(), delta)) e->accept(); }so maybe it depends on how mwheel is setup.
Ok now I got into a QSlider paradox...
I created the slider object in the ui, then I created a new slider subclass base on QAbstractSlider. Then in the ui I tried to promote the slider object to the new subclass, but in the "base class" selection, it doesn't have QAbstractSlider as a choice, so I chose "QSlider" and the program ended complaining about constructor doesn't match. But I have to use QAbstractSlider as the base class because Qslider doesn't have control for wheelEvent.
-
Ok now I got into a QSlider paradox...
I created the slider object in the ui, then I created a new slider subclass base on QAbstractSlider. Then in the ui I tried to promote the slider object to the new subclass, but in the "base class" selection, it doesn't have QAbstractSlider as a choice, so I chose "QSlider" and the program ended complaining about constructor doesn't match. But I have to use QAbstractSlider as the base class because Qslider doesn't have control for wheelEvent.
-
Hi,
Why inheriting from
QAbstractSliderif you want to customiseQSlider? -
Hi, because QSlider doesn't have access to wheelEvent, which is one of the thing I need.
-
I understand you want to reimplement the
wheelEventmethod but inheriting fromQAbstractSlidermeans that you're going to reimplement also the painting, etc. to make your custom slider match the design ofQSlider. On the other hand, subclassingQSliderand reimplement thewheelEventthere will reduce highly the work needed. -
Oh it does have a wheelEvent...I was looking at the document and I couldn't find the word on the page, so I thought it doesn't have.
-
When in doubt look at the base class(s) implementation and/or the link named
List of all members, including inherited members. -
Oh it does have a wheelEvent...I was looking at the document and I couldn't find the word on the page, so I thought it doesn't have.

