correct mirroring of players when spectating

This commit is contained in:
Max-Wilhelm Bruker 2010-05-29 17:31:16 +02:00
parent e1a728328e
commit f2092b89e9
18 changed files with 690 additions and 179 deletions

View file

@ -0,0 +1,38 @@
#include <QPainter>
#include <QSvgRenderer>
#include "handcounter.h"
#include "cardzone.h"
HandCounter::HandCounter(QGraphicsItem *parent)
: AbstractGraphicsItem(parent), number(0)
{
setCacheMode(DeviceCoordinateCache);
QSvgRenderer svg(QString(":/resources/hand.svg"));
handImage = new QPixmap(72, 72);
handImage->fill(Qt::transparent);
QPainter painter(handImage);
svg.render(&painter, QRectF(0, 0, 72, 72));
}
HandCounter::~HandCounter()
{
delete handImage;
}
void HandCounter::updateNumber()
{
number = static_cast<CardZone *>(sender())->getCards().size();
update();
}
QRectF HandCounter::boundingRect() const
{
return QRectF(0, 0, 72, 72);
}
void HandCounter::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
{
painter->drawPixmap(handImage->rect(), *handImage, handImage->rect());
paintNumberEllipse(number, painter);
}