On Monday 17 April 2006 23:38, Elie `woe` BLETON wrote:
> I'm currently trying to slightly enhance/customize ULineEdit to provide
> some basic "shell like" features, which supposes I can grab some of the
> keys that processKeyEvent() doesn't handle the way I want it to. I tried to
> create some inherited class of ULineEdit providing another implementation
> of processKeyEvent, filtering on keys that are of some interest to me, and
> sending the others to the regular ULineEdit processKeyEvent.
>
> My new object correctly receives key signals, but fails to propagate the
> "message" to its ancestor. I tried to add a "ULineEdit::processKeyEvent(e)"
> in my code in order to propagate the key event, but it fails do anything
> useful : content of the ULineEdit isn't updated properly.
Hmm, this should theoretically work.
I've attached a minimal example (modified base.cpp) which works for me[TM].
Perhaps you've forgotten to mark the event consumed so that it is not
processed again ... ?
> I'm quite a bit
> puzzled on this matter, so perhaps one of you guys can give me some hints
> on how I can achieve such a thing as "handling some specific keys". I'm not
> sure this was the right approach, and I'm completely open to brand new
> solutions if they provide results.
There are two ways to handle events in libUFO:
* Signals & Slots: Mainly used to catch events from built-in widgets or for
simple event processing
* Overriding process*Event methods: If you want to change the whole behaviour
of the event handling.
Regards,
Johannes
|