small changes
This commit is contained in:
parent
47eadb6f86
commit
c3fb56581d
12 changed files with 23 additions and 22 deletions
|
@ -70,7 +70,7 @@ void CardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
|||
void CardItem::setName(const QString &_name)
|
||||
{
|
||||
name = _name;
|
||||
update(boundingRect());
|
||||
update();
|
||||
}
|
||||
|
||||
void CardItem::setTapped(bool _tapped)
|
||||
|
@ -80,31 +80,31 @@ void CardItem::setTapped(bool _tapped)
|
|||
setTransform(QTransform().translate((float) CARD_WIDTH / 2, (float) CARD_HEIGHT / 2).rotate(90).translate((float) -CARD_WIDTH / 2, (float) -CARD_HEIGHT / 2));
|
||||
else
|
||||
setTransform(QTransform());
|
||||
update(boundingRect());
|
||||
update();
|
||||
}
|
||||
|
||||
void CardItem::setAttacking(bool _attacking)
|
||||
{
|
||||
attacking = _attacking;
|
||||
update(boundingRect());
|
||||
update();
|
||||
}
|
||||
|
||||
void CardItem::setFaceDown(bool _facedown)
|
||||
{
|
||||
facedown = _facedown;
|
||||
update(boundingRect());
|
||||
update();
|
||||
}
|
||||
|
||||
void CardItem::setCounters(int _counters)
|
||||
{
|
||||
counters = _counters;
|
||||
update(boundingRect());
|
||||
update();
|
||||
}
|
||||
|
||||
void CardItem::setAnnotation(const QString &_annotation)
|
||||
{
|
||||
annotation = _annotation;
|
||||
update(boundingRect());
|
||||
update();
|
||||
}
|
||||
|
||||
void CardItem::setDoesntUntap(bool _doesntUntap)
|
||||
|
@ -120,7 +120,7 @@ void CardItem::resetState()
|
|||
annotation = QString();
|
||||
setTapped(false);
|
||||
setDoesntUntap(false);
|
||||
update(boundingRect());
|
||||
update();
|
||||
}
|
||||
|
||||
CardDragItem *CardItem::createDragItem(int _id, const QPointF &_pos, const QPointF &_scenePos, bool faceDown)
|
||||
|
@ -215,7 +215,7 @@ QVariant CardItem::itemChange(QGraphicsItem::GraphicsItemChange change, const QV
|
|||
return value;
|
||||
} else if (change == ItemSelectedHasChanged) {
|
||||
qDebug("selection changed");
|
||||
update(boundingRect());
|
||||
update();
|
||||
return value;
|
||||
} else
|
||||
return QGraphicsItem::itemChange(change, value);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "cardlist.h"
|
||||
#include "carditem.h"
|
||||
|
||||
CardList::CardList(bool _contentsKnown)
|
||||
: QList<CardItem *>(), contentsKnown(_contentsKnown)
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#ifndef CARDLIST_H
|
||||
#define CARDLIST_H
|
||||
|
||||
#include "carditem.h"
|
||||
#include <QList>
|
||||
|
||||
class CardItem;
|
||||
|
||||
class CardList : public QList<CardItem *> {
|
||||
protected:
|
||||
bool contentsKnown;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "zoneviewzone.h"
|
||||
|
||||
CardZone::CardZone(Player *_p, const QString &_name, bool _hasCardAttr, bool _isShufflable, QGraphicsItem *parent, bool isView)
|
||||
: AbstractGraphicsItem(parent), player(_p), name(_name), cards(NULL), view(NULL), menu(NULL), hasCardAttr(_hasCardAttr), isShufflable(_isShufflable)
|
||||
: AbstractGraphicsItem(parent), player(_p), name(_name), cards(NULL), view(NULL), menu(NULL), doubleClickAction(0), hasCardAttr(_hasCardAttr), isShufflable(_isShufflable)
|
||||
{
|
||||
if (!isView)
|
||||
player->addZone(this);
|
||||
|
@ -27,7 +27,7 @@ void CardZone::clearContents()
|
|||
cards->clear();
|
||||
}
|
||||
|
||||
void CardZone::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||
void CardZone::mouseDoubleClickEvent(QGraphicsSceneMouseEvent */*event*/)
|
||||
{
|
||||
if (doubleClickAction)
|
||||
doubleClickAction->trigger();
|
||||
|
@ -71,8 +71,7 @@ CardItem *CardZone::getCard(int cardId, const QString &cardName)
|
|||
|
||||
CardItem *CardZone::takeCard(int position, int cardId, const QString &cardName)
|
||||
{
|
||||
if (position >= cards->size())
|
||||
return NULL;
|
||||
Q_ASSERT(position < cards->size());
|
||||
|
||||
CardItem *c = cards->takeAt(position);
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <QString>
|
||||
#include "cardlist.h"
|
||||
#include "carditem.h"
|
||||
#include "abstractgraphicsitem.h"
|
||||
|
||||
class Player;
|
||||
|
|
|
@ -26,7 +26,7 @@ void Counter::paint(QPainter *painter, const QStyleOptionGraphicsItem */*option*
|
|||
void Counter::setValue(int _value)
|
||||
{
|
||||
value = _value;
|
||||
update(boundingRect());
|
||||
update();
|
||||
}
|
||||
|
||||
void Counter::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
|
|
|
@ -59,7 +59,7 @@ void HandZone::addCardImpl(CardItem *card, int x, int /*y*/)
|
|||
card->setParentItem(this);
|
||||
card->resetState();
|
||||
card->setVisible(true);
|
||||
card->update(card->boundingRect());
|
||||
card->update();
|
||||
}
|
||||
|
||||
void HandZone::handleDropEvent(int cardId, CardZone *startZone, const QPoint &/*dropPoint*/, bool /*faceDown*/)
|
||||
|
|
|
@ -50,7 +50,7 @@ void LibraryZone::handleDropEvent(int cardId, CardZone *startZone, const QPoint
|
|||
|
||||
void LibraryZone::reorganizeCards()
|
||||
{
|
||||
update(boundingRect());
|
||||
update();
|
||||
}
|
||||
|
||||
void LibraryZone::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
|
|
|
@ -20,6 +20,7 @@ QRectF PileZone::boundingRect() const
|
|||
|
||||
void PileZone::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
qDebug("PileZone::paint");
|
||||
if (!cards->isEmpty()) {
|
||||
painter->save();
|
||||
cards->at(0)->paint(painter, option, widget);
|
||||
|
@ -47,7 +48,7 @@ void PileZone::handleDropEvent(int cardId, CardZone *startZone, const QPoint &/*
|
|||
void PileZone::reorganizeCards()
|
||||
{
|
||||
qDebug(QString("PileZone: reorganize, x=%1, y=%2, w=%3, h=%4").arg(boundingRect().x()).arg(boundingRect().y()).arg(boundingRect().width()).arg(boundingRect().height()).toLatin1());
|
||||
update(boundingRect());
|
||||
update();
|
||||
}
|
||||
|
||||
void PileZone::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
|
|
|
@ -31,7 +31,7 @@ void TableZone::addCardImpl(CardItem *card, int x, int y)
|
|||
qDebug(QString("table: appended %1 at pos %2: zValue = %3, x = %4, y = %5").arg(card->getName()).arg(cards->size() - 1).arg(card->zValue()).arg(x).arg(y).toLatin1());
|
||||
card->setParentItem(this);
|
||||
card->setVisible(true);
|
||||
card->update(card->boundingRect());
|
||||
card->update();
|
||||
}
|
||||
|
||||
void TableZone::handleDropEvent(int cardId, CardZone *startZone, const QPoint &dropPoint, bool faceDown)
|
||||
|
|
|
@ -52,7 +52,6 @@ void ZoneViewLayout::removeItem(ZoneViewWidget *item)
|
|||
{
|
||||
qDebug("ZoneViewLayout::removeItem");
|
||||
views.removeAt(views.indexOf(item));
|
||||
scene()->removeItem(item);
|
||||
reorganize();
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ void ZoneViewZone::addCardImpl(CardItem *card, int x, int /*y*/)
|
|||
{
|
||||
cards->insert(x, card);
|
||||
card->setParentItem(this);
|
||||
card->update(card->boundingRect());
|
||||
card->update();
|
||||
}
|
||||
|
||||
void ZoneViewZone::handleDropEvent(int cardId, CardZone *startZone, const QPoint &/*dropPoint*/, bool /*faceDown*/)
|
||||
|
@ -89,8 +89,7 @@ void ZoneViewZone::removeCard(int position)
|
|||
if (position >= cards->size())
|
||||
return;
|
||||
|
||||
CardItem *card = cards->at(position);
|
||||
cards->removeAt(position);
|
||||
CardItem *card = cards->takeAt(position);
|
||||
delete card;
|
||||
reorganizeCards();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue