Qt-interest Archive, April 2008
QGraphicsItem Question
Message 1 in thread
Hello All,
I've created a child class of QGraphicsItem (Qt v4.3.4). I would like
to override the
'mousePressEvent(QGraphicsSceneMouseEvent *event)' method since in
QGraphicsItem
it's a protected virtual void.
Here is the declaration in my header file:
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
Here is the simple test method from my cpp file:
void MosaicItem::mousePressEvent(QGraphicsSceneMouseEvent *event){
std::cout << "Mouse Press Event" << std::endl;
}
But when I click the mouse on my graphics items in the scene, I do not
get the cout.
Any suggests as to what I'm doing wrong?
Thanks,
Stacy Alley
--
[ signature omitted ]
Message 2 in thread
Did you call setAceptedMouseButtons(...) ?
-----Ursprüngliche Nachricht-----
Von: Stacy Alley (Astro) B6 [mailto:salley@xxxxxxxx]
Gesendet: Donnerstag, 17. April 2008 20:26
An: qt-interest@xxxxxxxxxxxxx
Betreff: QGraphicsItem Question
Hello All,
I've created a child class of QGraphicsItem (Qt v4.3.4). I would like
to override the
'mousePressEvent(QGraphicsSceneMouseEvent *event)' method since in
QGraphicsItem
it's a protected virtual void.
Here is the declaration in my header file:
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
Here is the simple test method from my cpp file:
void MosaicItem::mousePressEvent(QGraphicsSceneMouseEvent *event){
std::cout << "Mouse Press Event" << std::endl;
}
But when I click the mouse on my graphics items in the scene, I do not
get the cout.
Any suggests as to what I'm doing wrong?
Thanks,
Stacy Alley
--
[ signature omitted ]
Message 3 in thread
Also check QGraphicsView::setInteractive(..)
--
[ signature omitted ]
Message 4 in thread
Thanks for the replies! But I realized there was a flaw with the basic
design on this class.
My bad!
Acenes wrote:
> Also check QGraphicsView::setInteractive(..)
>
>
> --
> 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 ]