Qt-interest Archive, July 2007
QGraphicsItem childrens events
Message 1 in thread
Hi all... I'm new to qt and I have a question:
what is the best way to propagate mouse signals from a QGraphicsItem (A)
to its QGraphicsItem childrens (B1,B2,B3) ? in other words, how can I
detect if mouse is over or was-clicked-on one of the childrens of A
(B1,B2,B3) ? I'm not talking about QGraphicsItemGroup, so B1,B2 & B3
define A as their parent...
thanks a lot
Paolo
--
[ signature omitted ]
Message 2 in thread
QGraphicsView/QGraphicsSCene does propogate the events to the topmost
item.
So your child items should be able to capture and process mouse events
by overiding their handlers!
-----Original Message-----
From: Giampaolo Bellini [mailto:iw2lsi@xxxxxxxxx]
Sent: Wednesday, July 11, 2007 2:27 PM
To: qt-interest@xxxxxxxxxxxxx
Subject: QGraphicsItem childrens events
Hi all... I'm new to qt and I have a question:
what is the best way to propagate mouse signals from a QGraphicsItem (A)
to its QGraphicsItem childrens (B1,B2,B3) ? in other words, how can I
detect if mouse is over or was-clicked-on one of the childrens of A
(B1,B2,B3) ? I'm not talking about QGraphicsItemGroup, so B1,B2 & B3
define A as their parent...
thanks a lot
Paolo
--
[ signature omitted ]
Message 3 in thread
Hi Prateek
I know... but I've make a lot of tests and was no able to get it work...
with or without setHandlesChildEvents();
thanks for your attention
Paolo
On Wed, 2007-07-11 at 13:01, Prateek Tiwari wrote:
> QGraphicsView/QGraphicsSCene does propogate the events to the topmost
> item.
> So your child items should be able to capture and process mouse events
> by overiding their handlers!
>
> -----Original Message-----
> From: Giampaolo Bellini [mailto:iw2lsi@xxxxxxxxx]
> Sent: Wednesday, July 11, 2007 2:27 PM
> To: qt-interest@xxxxxxxxxxxxx
> Subject: QGraphicsItem childrens events
>
> Hi all... I'm new to qt and I have a question:
>
> what is the best way to propagate mouse signals from a QGraphicsItem (A)
> to its QGraphicsItem childrens (B1,B2,B3) ? in other words, how can I
> detect if mouse is over or was-clicked-on one of the childrens of A
> (B1,B2,B3) ? I'm not talking about QGraphicsItemGroup, so B1,B2 & B3
> define A as their parent...
>
> thanks a lot
>
> Paolo
>
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
--
[ signature omitted ]
Message 4 in thread
sorry, sent this private by accident.
---------- Forwarded message ----------
From: Thomas Dähling <t.daehling@xxxxxxxxxxxxxx>
Date: 11.07.2007 14:12
Subject: Re: QGraphicsItem childrens events
To: iw2lsi@xxxxxxxxx
What about simply fetching QGraphicsItem::children(), iterate over the
list and call the respective slot for each child manually?
f.e.:
void MyGraphicsScene::mousePressEvent(QGraphicsSceneMousEvent* mouseEvent)
{
QGraphicsItem* item = itemAt(mouseEvent->pos());
QList<QGraphicsItem*>::iterator it;
for (it = item->children().begin(); it != item->children().end(); ++it)
it->mousePressEvent(mouseEvent);
}
-- Thomas
11 Jul 2007 14:06:00 +0200, Giampaolo Bellini <iw2lsi@xxxxxxxxx>:
> Hi Prateek
>
> I know... but I've make a lot of tests and was no able to get it work...
> with or without setHandlesChildEvents();
>
> thanks for your attention
>
> Paolo
>
> On Wed, 2007-07-11 at 13:01, Prateek Tiwari wrote:
> > QGraphicsView/QGraphicsSCene does propogate the events to the topmost
> > item.
> > So your child items should be able to capture and process mouse events
> > by overiding their handlers!
> >
> > -----Original Message-----
> > From: Giampaolo Bellini [mailto:iw2lsi@xxxxxxxxx]
> > Sent: Wednesday, July 11, 2007 2:27 PM
> > To: qt-interest@xxxxxxxxxxxxx
> > Subject: QGraphicsItem childrens events
> >
> > Hi all... I'm new to qt and I have a question:
> >
> > what is the best way to propagate mouse signals from a QGraphicsItem (A)
> > to its QGraphicsItem childrens (B1,B2,B3) ? in other words, how can I
> > detect if mouse is over or was-clicked-on one of the childrens of A
> > (B1,B2,B3) ? I'm not talking about QGraphicsItemGroup, so B1,B2 & B3
> > define A as their parent...
> >
> > thanks a lot
> >
> > Paolo
> >
> >
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> > "unsubscribe" in the subject or the body.
> > List archive and information: http://lists.trolltech.com/qt-interest/
> >
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> > List archive and information: http://lists.trolltech.com/qt-interest/
> >
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
--
[ signature omitted ]
Message 5 in thread
Hmm.. I hope you have not blocked the progression of events in the
GraphivsView.
Be sure to invoke QGraphicsView::mousePressEvent() in your graphicsView
calss
else the events would not be propogatedto events.
Also check your handler prototype, teh argument is
QGraphicsSceneMouseEvent and not QMouseEvent.
Cheers!
Prateek
-----Original Message-----
From: Giampaolo Bellini [mailto:iw2lsi@xxxxxxxxx]
Sent: Wednesday, July 11, 2007 5:36 PM
To: qt-interest@xxxxxxxxxxxxx
Subject: RE: QGraphicsItem childrens events
Hi Prateek
I know... but I've make a lot of tests and was no able to get it work...
with or without setHandlesChildEvents();
thanks for your attention
Paolo
On Wed, 2007-07-11 at 13:01, Prateek Tiwari wrote:
> QGraphicsView/QGraphicsSCene does propogate the events to the topmost
> item.
> So your child items should be able to capture and process mouse events
> by overiding their handlers!
>
> -----Original Message-----
> From: Giampaolo Bellini [mailto:iw2lsi@xxxxxxxxx]
> Sent: Wednesday, July 11, 2007 2:27 PM
> To: qt-interest@xxxxxxxxxxxxx
> Subject: QGraphicsItem childrens events
>
> Hi all... I'm new to qt and I have a question:
>
> what is the best way to propagate mouse signals from a QGraphicsItem
> (A) to its QGraphicsItem childrens (B1,B2,B3) ? in other words, how
> can I detect if mouse is over or was-clicked-on one of the childrens
> of A
> (B1,B2,B3) ? I'm not talking about QGraphicsItemGroup, so B1,B2 & B3
> define A as their parent...
>
> thanks a lot
>
> Paolo
>
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
"unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
--
[ signature omitted ]
Message 6 in thread
Check the following :-
1. In case you have inherited QGraphicsView class, be sure that you have
called QGraphicsView::mousePressEvent() from you Graphics base class (I
mean base class handler).
2. FOr the item event handler the argument is "QGraphicsSceneMouseEvent"
.
Cheers!
Prateek
-----Original Message-----
From: Giampaolo Bellini [mailto:iw2lsi@xxxxxxxxx]
Sent: Wednesday, July 11, 2007 5:36 PM
To: qt-interest@xxxxxxxxxxxxx
Subject: RE: QGraphicsItem childrens events
Hi Prateek
I know... but I've make a lot of tests and was no able to get it work...
with or without setHandlesChildEvents();
thanks for your attention
Paolo
On Wed, 2007-07-11 at 13:01, Prateek Tiwari wrote:
> QGraphicsView/QGraphicsSCene does propogate the events to the topmost
> item.
> So your child items should be able to capture and process mouse events
> by overiding their handlers!
>
> -----Original Message-----
> From: Giampaolo Bellini [mailto:iw2lsi@xxxxxxxxx]
> Sent: Wednesday, July 11, 2007 2:27 PM
> To: qt-interest@xxxxxxxxxxxxx
> Subject: QGraphicsItem childrens events
>
> Hi all... I'm new to qt and I have a question:
>
> what is the best way to propagate mouse signals from a QGraphicsItem
> (A) to its QGraphicsItem childrens (B1,B2,B3) ? in other words, how
> can I detect if mouse is over or was-clicked-on one of the childrens
> of A
> (B1,B2,B3) ? I'm not talking about QGraphicsItemGroup, so B1,B2 & B3
> define A as their parent...
>
> thanks a lot
>
> Paolo
>
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
"unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
--
[ signature omitted ]
Message 7 in thread
Hi Prateek
problem solved... as you told me, it was just as simple as calling
mousePressEvent(mouseEvent);
for each childrens
Thanks a lot
Paolo
On Wed, 2007-07-11 at 14:45, Prateek Tiwari wrote:
> Check the following :-
>
> 1. In case you have inherited QGraphicsView class, be sure that you have
> called QGraphicsView::mousePressEvent() from you Graphics base class (I
> mean base class handler).
>
> 2. FOr the item event handler the argument is "QGraphicsSceneMouseEvent"
> .
>
> Cheers!
> Prateek
>
> -----Original Message-----
> From: Giampaolo Bellini [mailto:iw2lsi@xxxxxxxxx]
> Sent: Wednesday, July 11, 2007 5:36 PM
> To: qt-interest@xxxxxxxxxxxxx
> Subject: RE: QGraphicsItem childrens events
>
> Hi Prateek
>
> I know... but I've make a lot of tests and was no able to get it work...
> with or without setHandlesChildEvents();
>
> thanks for your attention
>
> Paolo
>
> On Wed, 2007-07-11 at 13:01, Prateek Tiwari wrote:
> > QGraphicsView/QGraphicsSCene does propogate the events to the topmost
> > item.
> > So your child items should be able to capture and process mouse events
>
> > by overiding their handlers!
> >
> > -----Original Message-----
> > From: Giampaolo Bellini [mailto:iw2lsi@xxxxxxxxx]
> > Sent: Wednesday, July 11, 2007 2:27 PM
> > To: qt-interest@xxxxxxxxxxxxx
> > Subject: QGraphicsItem childrens events
> >
> > Hi all... I'm new to qt and I have a question:
> >
> > what is the best way to propagate mouse signals from a QGraphicsItem
> > (A) to its QGraphicsItem childrens (B1,B2,B3) ? in other words, how
> > can I detect if mouse is over or was-clicked-on one of the childrens
> > of A
> > (B1,B2,B3) ? I'm not talking about QGraphicsItemGroup, so B1,B2 & B3
> > define A as their parent...
> >
> > thanks a lot
> >
> > Paolo
> >
> >
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
>
> > "unsubscribe" in the subject or the body.
> > List archive and information: http://lists.trolltech.com/qt-interest/
> >
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> > List archive and information: http://lists.trolltech.com/qt-interest/
> >
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
--
[ signature omitted ]