PDA

View Full Version : Up/Down Arrow Buttons / QSpinBox without inputputfield ?



Marv
12th July 2016, 14:16
Hello Forum!

I am wondering whats the "best" way to implement an "Up/Down"-Arrow Field.
I need something to "move up or down" Elements, preferable something like an QSpinbox, but without the textinput.

My first idea had been to use a QSpinBox and hide the Inputfield, but I could not figure out how to do this.
My second approach was reimplementation of an QAbstractspinbox but this also did not work as i expected.
Now I guess my best option is to subclass a QPushbutton/Icon and check if the click is in the upper or lower half of the image.

Any better Idea? Did I miss something?
Marv.

d_stranz
12th July 2016, 21:22
What do you mean by "up/down arrow field"? If you don't want the user to be able to change the text in the edit field, then you simply set the widget to read-only. If doesn't make much sense to have an up/down control without being able to show what value is going up and down.

Marv
13th July 2016, 08:29
I want to move items one position up or down (this happens as soon you press the button), therefor i need something like a QSpinBox, but without the numbers showen (the numbers (int) will be needed internally, but not displayed to the user).

anda_skoa
13th July 2016, 11:14
Two buttons in a vertical layout?

Cheers,
_

Marv
4th March 2017, 08:42
Sorry for the late reply. I searched a little while longer, but In the end I did as you suggested and it worked very well. Thanks!