<div dir="ltr"><div>I am having problem in setting setGeomtry of QGraphicsObject with
setRect of QGraphicsRectItem to the same position. (QGraphicsRectItem
inturn inherited from QGraphicsObject)<br><br>I have many QGraphicsItems
types, so I have a single QGObj (QGraphicsObject) class that can share a
QObject class for signal and slot.<br><br>I have small snippet below, may be my implementation is wrong or what I am trying
to archive may not be possible or setting the parameter is/are wrong.<br><br>The
flow of my work is <br>widget -> class <b>OuterItem</b> (parent is "widget")
-><br>class <b>innerItem</b> (parent is "OuterItem") -> <br>class <b>childItem</b> (parent is
"innerItem")<br><br>1. <b>OuterItem</b> is grey color rect<br>2.<b> innerItem </b>is blue color rect<br><br>to setRect for "<b>OuterItem</b>" is calculated using outerItem.childrenBoundingRect()<br><br>to setRect/setGeometry for "<b>innerItem</b>" class is innerItem.childboundaryRect()<br></div><div><div>I have a question:<br><br></div><div>1. Blue rectangle box should start drawing the rectangle from "<b>topchild</b>", but<br>one can see that there is displayment in the topleft corner, <br>but bottonleft corner get it right.<br><br></div><div>This is b'cos <b>innerItem</b>.childrenBoundingRect() would also contain QGraphicsRectitem of GrpItem,<br>this is can be overcome by re-calculationg manually.<br></div><div><br>Assume I got this (in the file line 300) and when I tried to set setGeomtry and setRect then there is mismatch, after this mismatch, if I click on to the <b>innerItem </b>(bluecolor) one can see that object is not selected (It should display as __main__innerItem<br><br></div><div>And I need to keep this object <b>innerItem</b> inherited from QGObj (which is inherited from QGraphicsObject)</div><br>What I am doing wrong in setting the QGraphicsRectItem (setRect) and QGraphicsObject (setGeomtry).<br></div><div><div><br></div></div></div>