qt-interest@trolltech.com
[Top] [All Lists]

Re: QSpinBox readonly?

Subject: Re: QSpinBox readonly?
From:
Date: Fri, 9 Mar 2007 05:25:24 -0800 PST
Thanks - I'll think about this.  The values aren't changed by a whole lot so pressing up/down via keyboard or mouse isn't really an issue.  What I did was to derive from QSpinBox and re-implement setReadOnly in combination with a keypress  event handler that throws keystrokes away (except up/down arrow keys).  This is a prototype, so we'll see what the real behavior needs when we get requirements.

----- Original Message ----
From: Gert van Loo <gert@xxxxxxxxxxxx>
To: qt-interest@xxxxxxxxxxxxx
Sent: Thursday, March 8, 2007 4:57:31 PM
Subject: RE: QSpinBox readonly?

Easiest solution would be to allow user editing of the value but then
round to the nearest correct/allowed value when the editing finishes.
I don't know your application but I would not like to press many times
to get to a value.
 
-- Gert.
 
-----Original Message-----
From: qt-interest-request@xxxxxxxxxxxxx [mailto:qt-interest-request@xxxxxxxxxxxxx]On Behalf Of susan@xxxxxxxxxxxx
Sent: 08 March 2007 15:45
To: qt-interest@xxxxxxxxxxxxx
Subject: Re: QSpinBox readonly?


>>Thanks - my problem is that I don't want the user to "edit" the value using the >>keyboard  in the line edit.  The line edit is for display purposes only, and the up/down >>buttons (arrow keys or mouse wheel) is the only mechanism used to change the value.  >>This is because the application only handles the values at set increments (not any >>arbitrary value in between the set increments).
>>
>>I guess I'll have to craft a derivation or something of the spin box...?

>Did you try 
>
>  lineEdit()->setEnabled( false )?


Tried this, and believe it or not, it didn't work.  The field is still editable :-/ 

I think I'll have to intercept the keypresses in the line edit and throw them away if they aren't the up/down arrows...


<Prev in Thread] Current Thread [Next in Thread>