diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2009-04-28 01:46:45 -0400 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2009-04-28 01:46:45 -0400 |
| commit | ffd42ba8bbb95e450c89b6734778eb75d08ad377 (patch) | |
| tree | e0c4d44bf1fab94d6c36d8c4b6f32d50b7e36b9b | |
| parent | b69c4e1979e9820599b04c44978794a72b1bdc43 (diff) | |
Don't rely on boundingRect
| -rw-r--r-- | sigmodr/widgets/mapeditor/WorldMapItem.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sigmodr/widgets/mapeditor/WorldMapItem.cpp b/sigmodr/widgets/mapeditor/WorldMapItem.cpp index 8a3f3f3d..770568c4 100644 --- a/sigmodr/widgets/mapeditor/WorldMapItem.cpp +++ b/sigmodr/widgets/mapeditor/WorldMapItem.cpp @@ -93,10 +93,8 @@ bool WorldMapItem::collidesWithItem(const QGraphicsItem* other, Qt::ItemSelectio const WorldMapItem* item = qgraphicsitem_cast<const WorldMapItem*>(other); if (!item) return false; - QRectF rect = boundingRect().adjusted(1, 1, -1, -1); - QRectF otherRect = item->boundingRect().adjusted(1, 1, -1, -1); - rect.moveTo(scenePos()); - otherRect.moveTo(item->scenePos()); + const QRectF rect(scenePos(), QPointF(m_map->width(), m_map->height())); + const QRectF otherRect(item->scenePos(), QPointF(item->m_map->width(), item->m_map->height())); return rect.intersects(otherRect); } @@ -156,7 +154,7 @@ void WorldMapItem::keyPressEvent(QKeyEvent* event) QList<QGraphicsItem*> items; if (!m_locked) { - items = scene()->items(QRectF(scenePos(), boundingRect().adjusted(1, 1, -1, -1).size())); + items = scene()->items(QRectF(scenePos(), QRectF(scenePos(), QSizeF(m_map->width(), m_map->height())).size())); QtConcurrent::blockingFilter(items, isSetWorldMapItem); items.removeAll(this); } |
