[Interest] QGraphicsWidget vs QGraphicsProxyWidget

maitai maitai at virtual-winds.org
Wed Mar 9 05:54:06 CET 2016


Hello,

QGraphicsProxyWidget is quite nice and works. There is a number of 
caveats though:

It doesn't inherit QGraphicsItem, so you cannot make it moveable etc. 
You can however have a container as a parent that derived from 
QGraphicsItem with no paint but the same boundingRect and shape and it 
will do the trick. Since QGraphicsProxyWidget derives from 
QGraphicsWidget gesture events like pinch are ok.

There is a bug with QGraphicsProxyWidget and retina screens (OS/X, iOS). 
See QTBUG-40630 for a description and a workaround which works for me.

Cheers
Philippe.

Le 08-03-2016 22:22, Murphy, Sean a écrit :
> I'm looking to add my own custom widget to a QGraphicsScene and I'm
> trying to understand which class is more appropriate for what I'm
> doing. I've read the documentation for both the QGraphicsProxyWidget
> and the QGraphicsWidget and I'm not seeing why I should prefer one
> over the other.
> 
> If it matters this is what I'm trying to do:
> I'm trying to create a base class that lives on a QGraphicsScene (so
> some sort of descendent of a QGraphicsItem) that allows me to place
> existing widgets I have on a surface. The idea is that the user can
> then add/remove/rearrange/resize these widgets to customize their
> layout.
> 
> Sean
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list