[Interest] Getting QGraphicsView from within a mouse event
Nicholas Yue
yue.nicholas at gmail.com
Tue Jun 16 18:08:32 CEST 2020
Thanks Giuseppe,
Got it working.
Cheers
On Mon, 15 Jun 2020 at 02:46, Giuseppe D'Angelo <giuseppe.dangelo at kdab.com>
wrote:
> Il 15/06/20 03:26, Nicholas Yue ha scritto:
> > The return widget object does not have a viewport() method from looking
> > at the QWidget - docs <https://doc.qt.io/qt-5/qwidget.html>
> >
> > void AttributeItem::mousePressEvent(QGraphicsSceneMouseEvent* event)
> > {
> > if (event->button()==Qt::LeftButton)
> > {
> > QWidget *w = event->widget();
> > } else
> > QGraphicsItem::mousePressEvent(event);
> > }
>
> Sorry, what I meant is the other way around: the widget returned *is*
> the viewport() of your QGraphicsView. (So, typically, getting the parent
> widget of that widget will give you QGV you're looking for.)
>
> HTH,
>
> --
> Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
> KDAB (France) S.A.S., a KDAB Group company
> Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
> KDAB - The Qt, C++ and OpenGL Experts
>
>
--
Nicholas Yue
Graphics - Arnold, Alembic, RenderMan, OpenGL, HDF5
Custom Dev - C++ porting, OSX, Linux, Windows
http://au.linkedin.com/in/nicholasyue
https://vimeo.com/channels/naiadtools
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200616/d09ce624/attachment.html>
More information about the Interest
mailing list