コード例 #1
0
ファイル: abstractcounter.cpp プロジェクト: DINKIN/Cockatrice
void AbstractCounter::incrementCounter()
{
    const int delta = static_cast<QAction *>(sender())->data().toInt();
    Command_IncCounter cmd;
    cmd.set_counter_id(id);
    cmd.set_delta(delta);
    player->sendGameCommand(cmd);
}
コード例 #2
0
void AbstractCounter::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
    if (event->button() == Qt::LeftButton) {
        Command_IncCounter cmd;
        cmd.set_counter_id(id);
        cmd.set_delta(1);
        player->sendGameCommand(cmd);
        event->accept();
    } else if (event->button() == Qt::RightButton) {
        Command_IncCounter cmd;
        cmd.set_counter_id(id);
        cmd.set_delta(-1);
        player->sendGameCommand(cmd);
        event->accept();
    } else if (event->button() == Qt::MidButton) {
        if (menu)
            menu->exec(event->screenPos());
        event->accept();
    } else
        event->ignore();
}