PDA

View Full Version : Double slider



whitefurrows
22nd February 2011, 14:21
Hello,

how can i build a Double slider look like this:
http://www.loaditup.de/files/588035.png

For this exaple have i use two sliders. The problem is i can't move both slider to the left or right side.

If i subclassing a slider, how can i implement the second slider to do that?

high_flyer
22nd February 2011, 15:36
I think libqext has such a slider implemented.
http://dev.libqxt.org/libqxt/wiki/Home//page/index

whitefurrows
22nd February 2011, 16:12
Thank you, i know that, but i don't want to use libqxt.

If it's to hard to subclassing a slider, can i shrink and grow my (two) sliders. Now is the question how can i shrink and grow the slider by the slider-value? Can you help me please?

high_flyer
22nd February 2011, 16:21
Now is the question how can i shrink and grow the slider by the slider-value?
Can you explain more what you mean?

whitefurrows
22nd February 2011, 18:33
For example, now is the end of the left slider by 85% and the begin of the right too. If i move the left slider to 0 % should the left slider shrink and the right slider grow. You know what i mean?

high_flyer
22nd February 2011, 18:50
resizing is not your problem, and it will have an effect you don't want - namely, when you change the size of the slider, it "sensitivity" will change, since the same range will be spread on a different length.
This is not the way to go about it.
You will have to create a custom widget that integrates to ranges on one slider.

whitefurrows
22nd February 2011, 22:13
I know how can i subclassing a slider to build my own widget, but i have no idea how can i integrate to ranges on one slider. Have you a little tip for me?

high_flyer
23rd February 2011, 09:12
Have you a little tip for me?
Why not look at how Qextlib have done it?

whitefurrows
23rd February 2011, 15:29
Thank you. Now i have copy the necessary code from the following files to my project:
qxtspanslider.h (http://dev.libqxt.org/libqxt/src/70d8e613826b/src/gui/qxtspanslider.h)
qxtspanslider_p.h (http://dev.libqxt.org/libqxt/src/70d8e613826b/src/gui/qxtspanslider_p.h)
qxtspanslider.cpp (http://dev.libqxt.org/libqxt/src/70d8e613826b/src/gui/qxtspanslider.cpp)

qxtnamespace.h (http://dev.libqxt.org/libqxt/src/70d8e613826b/src/core/qxtnamespace.h)
qxtglobal.h (http://dev.libqxt.org/libqxt/src/70d8e613826b/src/core/qxtglobal.h)
qxtglobal.cpp (http://dev.libqxt.org/libqxt/src/70d8e613826b/src/core/qxtglobal.cpp)

All looks fine and now i want to clean-up my code. I cant do that because i understand the the meaning of that:


&qxt_p();

The relevant code can you find in qxtglobal.h and the class QxtSpanSlider. Can you explain my?

Another question is, how can i calculate the three ranges( before span, between span, after span)? All together must be 100%, e.g.
http://www.loaditup.de/files/588390.png