mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 16:24:45 -07:00
Convert rest of source to 4-space indent
This commit is contained in:
parent
a171df744d
commit
1bc48a7849
146 changed files with 12810 additions and 12810 deletions
|
|
@ -6,9 +6,9 @@
|
|||
#include "cardzone.h"
|
||||
|
||||
HandCounter::HandCounter(QGraphicsItem *parent)
|
||||
: AbstractGraphicsItem(parent), number(0)
|
||||
: AbstractGraphicsItem(parent), number(0)
|
||||
{
|
||||
setCacheMode(DeviceCoordinateCache);
|
||||
setCacheMode(DeviceCoordinateCache);
|
||||
}
|
||||
|
||||
HandCounter::~HandCounter()
|
||||
|
|
@ -17,43 +17,43 @@ HandCounter::~HandCounter()
|
|||
|
||||
void HandCounter::updateNumber()
|
||||
{
|
||||
number = static_cast<CardZone *>(sender())->getCards().size();
|
||||
update();
|
||||
number = static_cast<CardZone *>(sender())->getCards().size();
|
||||
update();
|
||||
}
|
||||
|
||||
QRectF HandCounter::boundingRect() const
|
||||
{
|
||||
return QRectF(0, 0, 72, 72);
|
||||
return QRectF(0, 0, 72, 72);
|
||||
}
|
||||
|
||||
void HandCounter::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
||||
{
|
||||
painter->save();
|
||||
QSize translatedSize = painter->combinedTransform().mapRect(boundingRect()).size().toSize();
|
||||
QPixmap cachedPixmap;
|
||||
painter->save();
|
||||
QSize translatedSize = painter->combinedTransform().mapRect(boundingRect()).size().toSize();
|
||||
QPixmap cachedPixmap;
|
||||
#if QT_VERSION >= 0x040600
|
||||
if (!QPixmapCache::find("handCounter" + QString::number(translatedSize.width()), &cachedPixmap)) {
|
||||
if (!QPixmapCache::find("handCounter" + QString::number(translatedSize.width()), &cachedPixmap)) {
|
||||
#else
|
||||
if (!QPixmapCache::find("handCounter" + QString::number(translatedSize.width()), cachedPixmap)) {
|
||||
if (!QPixmapCache::find("handCounter" + QString::number(translatedSize.width()), cachedPixmap)) {
|
||||
#endif
|
||||
QSvgRenderer svg(QString(":/resources/hand.svg"));
|
||||
cachedPixmap = QPixmap(translatedSize);
|
||||
cachedPixmap.fill(Qt::transparent);
|
||||
QPainter painter(&cachedPixmap);
|
||||
svg.render(&painter, QRectF(0, 0, translatedSize.width(), translatedSize.height()));
|
||||
QPixmapCache::insert("handCounter" + QString::number(translatedSize.width()), cachedPixmap);
|
||||
}
|
||||
painter->resetTransform();
|
||||
painter->drawPixmap(cachedPixmap.rect(), cachedPixmap, cachedPixmap.rect());
|
||||
painter->restore();
|
||||
|
||||
paintNumberEllipse(number, 24, Qt::white, -1, -1, painter);
|
||||
QSvgRenderer svg(QString(":/resources/hand.svg"));
|
||||
cachedPixmap = QPixmap(translatedSize);
|
||||
cachedPixmap.fill(Qt::transparent);
|
||||
QPainter painter(&cachedPixmap);
|
||||
svg.render(&painter, QRectF(0, 0, translatedSize.width(), translatedSize.height()));
|
||||
QPixmapCache::insert("handCounter" + QString::number(translatedSize.width()), cachedPixmap);
|
||||
}
|
||||
painter->resetTransform();
|
||||
painter->drawPixmap(cachedPixmap.rect(), cachedPixmap, cachedPixmap.rect());
|
||||
painter->restore();
|
||||
|
||||
paintNumberEllipse(number, 24, Qt::white, -1, -1, painter);
|
||||
}
|
||||
|
||||
void HandCounter::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::RightButton) {
|
||||
emit showContextMenu(event->screenPos());
|
||||
event->accept();
|
||||
}
|
||||
if (event->button() == Qt::RightButton) {
|
||||
emit showContextMenu(event->screenPos());
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue