summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-04-28 01:46:45 -0400
committerBen Boeckel <MathStuf@gmail.com>2009-04-28 01:46:45 -0400
commitffd42ba8bbb95e450c89b6734778eb75d08ad377 (patch)
treee0c4d44bf1fab94d6c36d8c4b6f32d50b7e36b9b
parentb69c4e1979e9820599b04c44978794a72b1bdc43 (diff)
Don't rely on boundingRect
-rw-r--r--sigmodr/widgets/mapeditor/WorldMapItem.cpp8
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);
}