[Qt-interest] (QWidget *) arriving through QGraphicsItem::paint(...) is not the (QGraphicsView *) expected

Giuseppe D'Angelo dangelog at gmail.com
Sat Jul 16 21:24:33 CEST 2011


> Here is what is happening. The single instance of MyGraphicsView that
> I construct is not the same object (QWidget *) that
> QGraphicsItem::paint(..) is receiving via its third argument. That is
> the case even though I am using the default viewport, not a QGLWidget,
> to render.
>
> How can a child of QGraphicsItem find the QGraphicsView on which it is
> being viewed?

The third argument should actually be the viewport() of your QGraphicsView.
Did you check if its _parent_ is the instance of your QGraphicsView subclass?

-- 
Giuseppe D'Angelo



More information about the Qt-interest-old mailing list