diff options
Diffstat (limited to 'sigmodr')
-rw-r--r-- | sigmodr/widgets/MapItem.cpp | 1 | ||||
-rw-r--r-- | sigmodr/widgets/MapScene.cpp | 24 |
2 files changed, 9 insertions, 16 deletions
diff --git a/sigmodr/widgets/MapItem.cpp b/sigmodr/widgets/MapItem.cpp index 22dce924..57965ef3 100644 --- a/sigmodr/widgets/MapItem.cpp +++ b/sigmodr/widgets/MapItem.cpp @@ -34,6 +34,7 @@ MapItem::MapItem(const bool resizable, QGraphicsScene* parent) : m_resizable(resizable) { setAcceptHoverEvents(true); + setFlags(ItemIsMovable | ItemIsSelectable | ItemDoesntPropagateOpacityToChildren); } void MapItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) diff --git a/sigmodr/widgets/MapScene.cpp b/sigmodr/widgets/MapScene.cpp index bb12ea58..220106c7 100644 --- a/sigmodr/widgets/MapScene.cpp +++ b/sigmodr/widgets/MapScene.cpp @@ -181,10 +181,8 @@ void MapScene::showEffects(const int state) effect->hide(); else effect->show(); - if (Qt::PartiallyChecked < state) - effect->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable); - else - effect->setFlags(0); + effect->setFlag(QGraphicsItem::ItemIsMovable, Qt::PartiallyChecked < state); + effect->setFlag(QGraphicsItem::ItemIsSelectable, Qt::PartiallyChecked < state); } } @@ -197,10 +195,8 @@ void MapScene::showTiles(const int state) tile->hide(); else tile->show(); - if (Qt::PartiallyChecked < state) - tile->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable); - else - tile->setFlags(0); + tile->setFlag(QGraphicsItem::ItemIsMovable, Qt::PartiallyChecked < state); + tile->setFlag(QGraphicsItem::ItemIsSelectable, Qt::PartiallyChecked < state); } } @@ -213,10 +209,8 @@ void MapScene::showTrainers(const int state) trainer->hide(); else trainer->show(); - if (Qt::PartiallyChecked < state) - trainer->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable); - else - trainer->setFlags(0); + trainer->setFlag(QGraphicsItem::ItemIsMovable, Qt::PartiallyChecked < state); + trainer->setFlag(QGraphicsItem::ItemIsSelectable, Qt::PartiallyChecked < state); } } @@ -229,9 +223,7 @@ void MapScene::showWarps(const int state) warp->hide(); else warp->show(); - if (Qt::PartiallyChecked < state) - warp->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable); - else - warp->setFlags(0); + warp->setFlag(QGraphicsItem::ItemIsMovable, Qt::PartiallyChecked < state); + warp->setFlag(QGraphicsItem::ItemIsSelectable, Qt::PartiallyChecked < state); } } |