[Qt-interest] Find main window from widget
yunqiu liu
yunqiuliu at yahoo.com
Sat Jan 22 22:21:03 CET 2011
Hi Derek,
you could try,
1, declare a signal function in subclass of QGraphicsItem
For example, in subclass "sGraphicsItem",
signals:
void pos_hoverMoveEvent_signal(int,int);
2, in function sGraphicItem::hoverMoveEvent ( QGraphicsSceneHoverEvent * event )
get x and y position
emit pos_hoverMoveEvent_signal(x,y);
3, try to build the connect of signal and slot callback function between two
objects(graphicsitem and label)
Thanks,
YQ
________________________________
From: "Cole, Derek" <dcole at integrity-apps.com>
To: qt-interest at qt.nokia.com
Sent: Sat, January 22, 2011 9:34:56 AM
Subject: [Qt-interest] Find main window from widget
Find main window from widget
Hello,
If I have subclass a QGraphicsItem, and I want to send some information from the
hoverMoveEvent back to a label that is in my main UI, how do I get that? Do I
just loop over event.widget().parentWidget() until that returns zero, and then I
can try to do a findChild<QLabel *>(labelName)?
I thought there would be an easy way to find another widget from within one, but
its not popping out at me anyway.
I basically want a label to update with my pixel coordinates as I mouse over
this QGraphicsItem
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110122/1e5c9f0a/attachment.html
More information about the Qt-interest-old
mailing list