[Interest] QGraphicsWidget vs QGraphicsProxyWidget

Igor Mironchik igor.mironchik at gmail.com
Wed Mar 9 06:11:09 CET 2016


Hi,


On 09.03.2016 07:54, maitai wrote:
> 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.

It's not true... 
QGraphicsItem->QGraphicsObject->QGraphicsWidget->QGraphicsProxyWidget

> 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
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest




More information about the Interest mailing list