I've committed a new widget to KOffice which is a combobox-like widget consisting of a numeric input and a slider that pops up. The really neat thing about this new widget is that it's themeable right out of the box because I've reused QStyle to draw it.
[image:2756 width=440]
For the API I've tried to do thins like in QDoubleSpinBox. It still needs to mature a bit, but it's already usable. If people are interested I would be more than willing to move it to kdelibs

double border
Hi Casper.
I noted 2 borders around the white area of the widget. An editable combobox is typically a line edit with a button next to it. So you avoid having 2 borders like your screenshots above have. One border around the widget and one around the line edit is one too many
Maybe that's a way to remove that double border?
Also; I suggest you inherit from a similar widget instead of from plain QWidget since now you still have to implement full accessibility support.
Thanks
re: double border
Hi
Yes I noticed that when i made the screenshots as well, and it should be possible to fix that.
About inheriting from a similar widget then I thought about it, but unfortunately it poses some other problems. Providing accessabillity isn't that big a deal as I do rely on QLineEdit and QSlider for most of the actual stuff.
Even the QComboBox does it like that.
behavior
Hello Casper!
I once tried creating such a slider for kde, but I failed trying to forward the combobox-mouseevents to the slider. Well, you succeeded!
When the slider pops up, I think it should be horizontally positioned so that the slider's pointer is always exactly under the mousecursor. This way, you don't "reset" the value when the mouse moves one pixel.
Could you make the widget appear as a normal qlabel with the value printed as plain text (or blue and underlined), and only show the numinput and popup the slider when the user clicks/drags it? Maybe an option in the api?
For some uses, the numinput-box might be useless altogether and a qlabel with a popup-slider is enough?
Killing those useless +/- spinbox-arrows is great!
Oh, and I think both sliders have much more height than what's needed. KDE has too many margins.
thanks for KoSliderCombo, I hope it goes to kdelibs!
re: behaviour
I actually had a lot of trouble getting it to show up like it does, and right now it doesn't directly allow you to move the slider - that takes another click
If I make it so then yes i agree it should be centerred so you don't change the value just by clicking.
About making it look like a normal label then no I don't think I like that. I mean it doesn't hurt anyone to be able to type.
Yes getting away with those+/- is great
agree about slider height
mmh, that extra-click
mmh, that extra-click hurts.
I tried to force the slider following the pressed button using setSliderDown, grabMouse, QWidget::mouseGrabber() and everything that seemed remotely helpful, but it just didn't work.
Good luck!
did you try...
As the popup window is a new window the widget hierarchy is probably a bit odd.
Did you try to explicitly give focus to the window that shows up?
my 0,02