作为标题线索,我尝试通过旋转组本身或者迭代子项来旋转组边界矩形。Qt场景项目组边界矩形没有跟随旋转
我是否需要对组进行某种更新来限制组件的大小?当视图显示它时调整形状?
片段为PySide:
R1 = scene.addRect(itemGroup.boundingRect())
R1.setPos(itemGroup.pos())
scene.addRect(itemGroup.boundingR())
# case 1 - Rotate group through iteration
for item in itemGroup.childItems() :
item.rotate(90)
# case 2 - Rotete whole group
itemGroup.rotate(90)
R2 = scene.addRect(itemGroup.boundingRect())
R2.setPos(itemGroup.pos())
我不知道这是否与您的probem链接,但您应该使用QGraphicsRectItem(http://qt-project.org/doc/qt- 4.8/qgraphicsrectitem.html)而不是使用“addRect”。图形项目类更健壮。 – halflings 2013-04-11 22:17:54