qslider

QSlider mouse direct jump

帅比萌擦擦* 提交于 2019-11-29 22:12:20
Instead of stepping when the user clicks somewhere on the qslider I want to make the slider jump to that position. How can this be implemented ? ScarCode Well, I doubt that Qt has a direct function for this purpose. Try to use custom widgets. This should work! Try the following logic class MySlider : public QSlider { protected: void mousePressEvent ( QMouseEvent * event ) { if (event->button() == Qt::LeftButton) { if (orientation() == Qt::Vertical) setValue(minimum() + ((maximum()-minimum()) * (height()-event->y())) / height() ) ; else setValue(minimum() + ((maximum()-minimum()) * event->x())

Range slider in Qt (two handles in a QSlider) [closed]

谁都会走 提交于 2019-11-28 20:23:05
I am using Visual Studio 2010 with Qt 5.0.1 integrated. I need a range selection in QSlider . Is it possible to get two handles? Below is an image illustrating what I need. AmusingTeebs I had the exact same problem. I thought about using the QxtSpanSlider, and although they have beautiful code, they don't keep their code up to date anymore. So, I decided to make my own. I haven't spent that much time on this, so there are kludges and probably bugs. However, it should be at a point to where you can copy/paste it into your project. I hope it'll point you in the right direction. *note, before you

QSlider mouse direct jump

只愿长相守 提交于 2019-11-28 18:35:32
问题 Instead of stepping when the user clicks somewhere on the qslider I want to make the slider jump to that position. How can this be implemented ? 回答1: Well, I doubt that Qt has a direct function for this purpose. Try to use custom widgets. This should work! Try the following logic class MySlider : public QSlider { protected: void mousePressEvent ( QMouseEvent * event ) { if (event->button() == Qt::LeftButton) { if (orientation() == Qt::Vertical) setValue(minimum() + ((maximum()-minimum()) *