Hi all!

I have boundingRect() function in my GraphicsItem and it doesn't work
with class members.

When function returns explicitly constructed QRectF everything goes fine -

def boundingRect(self):
    return QtCore.QRectF((150/-2) - 1, (50/-2) - 1, 150 + 2, 50 + 2)

but when I want to calculate rectangle using class members -

def boundingRect(self):
    margin = 1
    tempBoundRect = QtCore.QRectF(0, 0, self.nodeWidth, self.nodeHeight)
    tempBoundRect.translate(-tempRect.center())
    return tempBoundRect.adjusted(-margin,  -margin,  margin,  margin))

- it fails, saying unhandled AttributeError nodeWidth.
Can't find anything about it. May be it's something obvious.
Thank you.
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to