Qt-interest Archive, December 2006
Inverse UP and DOWN button function
Message 1 in thread
I use Qt 4.1.2
=====================
I wanna realize a spin box to turn page up and down.
It would be more natural to click the *up button* to turn to the
previous page of spreadsheet
I want the up arrow to decrease the value and the down arrow to increase it.
But the spin box does not provide the function to reverse the two
button's function.
Can some one provide a smart salution to do this?
//bow
--
[ signature omitted ]
Message 2 in thread
cookiecc chu wrote:
> I use Qt 4.1.2
> =====================
> I wanna realize a spin box to turn page up and down.
> It would be more natural to click the *up button* to turn to the
> previous page of spreadsheet
> I want the up arrow to decrease the value and the down arrow to increase
> it.
> But the spin box does not provide the function to reverse the two
> button's function.
>
> Can some one provide a smart salution to do this?
Try subclassing qabstractspinbox and implement your own
stepUp() and stepDown() methods like shown in the sources:
void QAbstractSpinBox::stepUp()
{
stepBy(1);
}
void QAbstractSpinBox::stepDown()
{
stepBy(-1);
}
imho you only need to swap the two stepBy() values as you need.
--
[ signature omitted ]
Message 3 in thread
cookiecc chu schrieb:
> I want the up arrow to decrease the value and the down arrow to increase
> it.
> But the spin box does not provide the function to reverse the two
> button's function.
>
> Can some one provide a smart salution to do this?
I'd have suggested
yourSpinBox.setSingleStep(-1)
but the docs (of 4.2.2) say
"Setting a singleStep value of less than 0 does nothing." :-(
Martin
--
[ signature omitted ]