Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 7

Qt-interest Archive, March 2002
child-parent events management


Message 1 in thread

Hi all,
Is there any possibilities to construct 3 child widgets for a parent widget and automaticly receive events in the childs without forwarding them from the parent widget?
I tried with mousePressEvent and didn't work.

Radu.
-- 
 [ signature omitted ] 

Message 2 in thread

Yes,

Call installEventFilter(childObject) for parent object (in parent constructor, for instance), and then you can reimplement "virtual bool eventFilter ( QObject * watched,
QEvent * e )" for parent object. In this function you will receive events from 'this' object and from child.

JK

Radu Ursu wrote:

> Hi all,
> Is there any possibilities to construct 3 child widgets for a parent widget and automaticly receive events in the childs without forwarding them from the parent widget?
> I tried with mousePressEvent and didn't work.
>
> Radu.
> --
>
> --
> List archive and information: http://qt-interest.trolltech.com


Message 3 in thread

Jarek Kobus wrote:

> Yes,
>
> Call installEventFilter(childObject) for parent object (in parent constructor, for instance), and then you can reimplement "virtual bool eventFilter ( QObject * watched,
> QEvent * e )" for parent object. In this function you will receive events from 'this' object and from child.
>
> JK
>
> Radu Ursu wrote:
>
> > Hi all,
> > Is there any possibilities to construct 3 child widgets for a parent widget and automaticly receive events in the childs without forwarding them from the parent widget?

I'm sorry, I've taken 'without' as 'with'...
But when you return false from eventFilter in child it shouldn't be forwarded to parent.

JK

>
> > I tried with mousePressEvent and didn't work.
> >
> > Radu.
> > --
> >
> > --
> > List archive and information: http://qt-interest.trolltech.com


Message 4 in thread

I want all the 3 childs and the parent to receive all the events. I don't want to interfear. I don't know if it is possible.
Radu.


On Wed, Mar 20, 2002 at 08:22:09AM +0100, Jarek Kobus wrote:
> 
> 
> Jarek Kobus wrote:
> 
> > Yes,
> >
> > Call installEventFilter(childObject) for parent object (in parent constructor, for instance), and then you can reimplement "virtual bool eventFilter ( QObject * watched,
> > QEvent * e )" for parent object. In this function you will receive events from 'this' object and from child.
> >
> > JK
> >
> > Radu Ursu wrote:
> >
> > > Hi all,
> > > Is there any possibilities to construct 3 child widgets for a parent widget and automaticly receive events in the childs without forwarding them from the parent widget?
> 
> I'm sorry, I've taken 'without' as 'with'...
> But when you return false from eventFilter in child it shouldn't be forwarded to parent.
> 
> JK
> 
> >
> > > I tried with mousePressEvent and didn't work.
> > >
> > > Radu.
> > > --
> > >
> > > --
> > > List archive and information: http://qt-interest.trolltech.com
> 

-- 
 [ signature omitted ]