[Qt-interest] How do I turn-off/hide the text cursor in QSpinBox?
Sean Harmer
sean.harmer at maps-technology.com
Thu Mar 31 23:16:32 CEST 2011
Hi,
On 31/03/2011 20:53, Atlant Schmidt wrote:
> Sean:
>
> First thing I tried! ;-)
>
> Unfortunately, that also makes the entire spin-box
> read-only; not only can't you edit the text of the
> value, you can't change it's value by pressing
> the buttons either.
Hmmm, if you still want to be able to use the button to change the value
but not the line edit (since you said it is purely a touch app) then one
approach is to subclass QSpinBox and in the constructor of your
subclass, use the protected QAbstractSpinBox::lineEdit() function to get
a pointer to the line edit sub-control and then call setReadOnly( true )
on that.
That should leave the spin box buttons active and allow you to change
the value but still have the text cursor hidden.
Cheers,
Sean
More information about the Qt-interest-old
mailing list