Merge pull request #897 from poixen/counter_issue

Fixed accidental +/- of counters when using middle click menu
This commit is contained in:
Zach 2015-04-01 15:54:41 -04:00
commit fb49a8867e

View file

@ -88,23 +88,25 @@ void AbstractCounter::setValue(int _value)
void AbstractCounter::mousePressEvent(QGraphicsSceneMouseEvent *event) void AbstractCounter::mousePressEvent(QGraphicsSceneMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) { if (isUnderMouse()) {
Command_IncCounter cmd; if (event->button() == Qt::LeftButton) {
cmd.set_counter_id(id); Command_IncCounter cmd;
cmd.set_delta(1); cmd.set_counter_id(id);
player->sendGameCommand(cmd); cmd.set_delta(1);
event->accept(); player->sendGameCommand(cmd);
} else if (event->button() == Qt::RightButton) { event->accept();
Command_IncCounter cmd; } else if (event->button() == Qt::RightButton) {
cmd.set_counter_id(id); Command_IncCounter cmd;
cmd.set_delta(-1); cmd.set_counter_id(id);
player->sendGameCommand(cmd); cmd.set_delta(-1);
event->accept(); player->sendGameCommand(cmd);
} else if (event->button() == Qt::MidButton) { event->accept();
if (menu) } else if (event->button() == Qt::MidButton) {
menu->exec(event->screenPos()); if (menu)
event->accept(); menu->exec(event->screenPos());
} else event->accept();
}
}else
event->ignore(); event->ignore();
} }