about harmonia

Kristian kjkilpi at gmail.com
Tue Oct 10 01:45:30 PDT 2006

On Tue, 10 Oct 2006 06:17:06 +0300, Josh Stern <josh_usenet at phadd.net>  

> On Sat, 07 Oct 2006 12:28:42 +0300, Kristian wrote:
>> On Sat, 07 Oct 2006 04:38:39 +0300, Hasan Aljudy  
>> <hasan.aljudy at gmail.com>
>> wrote:
>>> ns wrote:
>>>> The harmonia wiki does not seem to have much content.
>>>>  http://harmonia.terrainformatica.com/pmwiki.php/Harmonia
>>> oh btw, this is the project's home page, it still has contents.
>>> http://harmonia.terrainformatica.com/
>> Looks promising. :) I like very much the sinking/bubbling event
>> dispatching. IMHO, that's the correct order to deliver event messages.
>> E.g. when the mouse is clicked, the topmost widget (the application
>> object, actually) will get the event message first, and finally the
>> bottommost widget.
>> For instance, Qt sends the event message directly to the bottommost
>> widget. If you like to catch the message, then you have to create an  
>> event
>> handler and install it for the widget. Not good.
> Hi, I'm not familiar with Harmonia, but it sounds like you are implying
> some limitations for Qt that are not really there.   Have a look at the
> docs for QCoreApplication::notify()
> http://doc.trolltech.com/4.2/qcoreapplication.html#notify
> and QObject::installEventFilter()
> http://doc.trolltech.com/4.2/qobject.html#installEventFilter
> and see if you agree.

Well, I don't know if it's a limitation, but a feature. And yes, you can  
catch events by the 'QCoreApplication::notify()' function also. Please  
tell me if I am wrong, but one cannot catch events of another widget  
without using 'QCoreApplication::notify()' or event handlers. For example:

class Button {
     virtual bool event(QEvent *e);

class Container {
     virtual bool event(QEvent *e);

Button B;
Container C;


The container 'C' contains the button 'B'. When the user clicks a mouse  
button over 'B', the mouse click event will be delivered to 'B' and only  
to it. That is, 'Container::event()' will not be called. So, if 'C' wants  
to know if a mouse button has been clicked inside it, even if the click  
happens over some of its subitems, you have to redirect events from 'C's  
subitems (i.e. 'B') to 'C' somehow. One way is to create an event handler  
and install it to all the 'C's subitems ('B'). The event filter then calls  
'Container::event()' (or some other function) when necessary.

In sinking/bubbling first 'Container::event()' will be called, then  
'Button::event()' if 'Container::event()' allows it (i.e. it didn't catch  
the event). So, no need to do any 'tricks' with event filters, etc.

More information about the Digitalmars-d-dwt mailing list