[Qt-interest] Event Filter
phil prentice
philp.cheer at talktalk.net
Wed Aug 11 20:31:41 CEST 2010
Hi Atlant
Yes I did think about that.
However it would mean problems if for example they wanted to type 95 in
because as soon as they typed 9 it would be changed to 10, so they would have
to edit the 1 to 6 and the 0 to 5. I do agree that it is an option.
Thanks
Phil
On Wednesday 11 August 2010 17:21, you wrote:
> Phil:
>
> If it were my design, I'd catch the valueChanged signal,
> coerce the value to the "nearest 5", and setValue on the
> spin box, taking care that I don't get stuck in a loop
> of valueChanged signals.
>
> This lets the user use the keyboard but forces the values
> to be as you want them *AND* gives the user immediate
> visual feedback that you're looking for a "nearest 5"
> sort of value.
>
> Atlant
>
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com
> [mailto:qt-interest-bounces at trolltech.com] On Behalf Of phil prentice Sent:
> Wednesday, August 11, 2010 12:01 PM
> To: qt-interest at trolltech.com
> Subject: [Qt-interest] Event Filter
>
> Hi
>
> I've been using QT for many years now, but I still consider myself a bit
> of a novice. I am wondering if its better(more efficient) to use an
> event-filter or to sub-class widgets and catch events that way.
>
> Basically I have an integer spin-box which increments in blocks of 5.
> Only 5,10,15,....are valid inputs. I dont want the user to be able to type
> in 6 or 7 etc. I dont know what the standard method is to do this, but my
> thinking is that the user should only be allowed to use the up&down arrows
> and keys to drive it. So I thought that I might just stop keyboard numeric
> input. I could sub-class or use an event filter. Which would be best?
>
> Secondly I have some other sub-classed frame objects that I need to
> detect if the mouse has been selected inside of them. I could use the
> mousePressEvent() for those objects
> or
> I could again use the same event-filter (especially if I already have one
> available from above), but this time catching mouse events. If I did'nt
> have the event-filter from above I would probably stick with the
> mousePressEvent().
>
> What would you all recommend?
>
> Thanks for any suggestions
> Phil
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
> This e-mail and the information, including any attachments, it contains are
> intended to be a confidential communication only to the person or entity to
> whom it is addressed and may contain information that is privileged. If the
> reader of this message is not the intended recipient, you are hereby
> notified that any dissemination, distribution or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, please immediately notify the sender and destroy
> the original message.
>
> Thank you.
>
> Please consider the environment before printing this email.
-------------------------------------------------------
More information about the Qt-interest-old
mailing list