View Full Version : QGraphicsWidget vs. QGraphicsRectItem
Bill
24th July 2009, 14:45
Hello,
I've got a question concerning the QGraphicsWidget. I used QGraphicsRectItem before as a base class for MyRectangle class. Now I switched to QGraphicsWidget and as it seems the rectangles on the scene are ~4px above the expected position (as compared to QGraphicsRectItem)...
Why is that? Is it possible to correct this situation?
Thanks,
Regards,
Bill
Lykurg
24th July 2009, 15:07
Why have you changed, because a QGraphics_XYZ_Item is in the most cases the better option since it is "lighter" than a QGraphicsWidget.
QGraphicsWidget should be positioned like every other item but be aware of the widget's window frame margins and widget's contents margins.
wagmare
27th July 2009, 07:19
i think its because of ContentsMargins of QGraphicsProxyWidget
check this link
http://doc.trolltech.com/4.5/qgraphicsproxywidget.html
Bill
27th July 2009, 09:02
Why have you changed, because a QGraphics_XYZ_Item is in the most cases the better option since it is "lighter" than a QGraphicsWidget.
QGraphicsWidget should be positioned like every other item but be aware of the widget's window frame margins and widget's contents margins.
Hi,
I had to switch to QGraphicsWidget because I was struggling to draw a resize handle on my custom QGraphicsRectItem. I will only have around 10 items on the scene, so I think the performance should be ok...
Thanks for your help, I'll try to investigate the QGraphicsProxyWidget properties.
Regards,
Bill
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.