【发布时间】:2013-12-03 23:38:00
【问题描述】:
我想阻止标签在我的场景中发生碰撞,因此使用此代码检查碰撞:-
QGraphicsTextItem *textLabel = new QGraphicsTextItem;
....
addItem(textLabel);
//check for collision
QList<QGraphicsItem*> items = this->items(textLabel>boundingRect(),Qt::IntersectsItemBoundingRect);
我从来没有在列表中找到任何项目,但在屏幕上我可以看到冲突。我是不是看错了文档?
【问题讨论】:
-
尝试调试
textLabel>boundingRect()的结果。您可能会注意到位置始终相同。
标签: qt collision qgraphicsscene