diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2009-03-19 13:10:12 -0400 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2009-03-19 13:10:12 -0400 |
commit | 2d2000bfe59fe20c140d892a874b29475b3e7121 (patch) | |
tree | b8c0d62e1a8a37290f7327e15c80b15bf4c50b8c /sigmodr | |
parent | 048364a475dba0f5259ba13905032acfbc6c9b8d (diff) | |
download | sigen-2d2000bfe59fe20c140d892a874b29475b3e7121.tar.gz sigen-2d2000bfe59fe20c140d892a874b29475b3e7121.tar.xz sigen-2d2000bfe59fe20c140d892a874b29475b3e7121.zip |
Clean up flag settings
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); } } |