mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 08:34:52 -07:00
made counters look nicer
This commit is contained in:
parent
5d40996c0b
commit
ae82996c0e
9 changed files with 59 additions and 51 deletions
|
|
@ -6,7 +6,7 @@
|
|||
#include "zoneviewzone.h"
|
||||
|
||||
CardZone::CardZone(Player *_p, const QString &_name, bool _hasCardAttr, bool _isShufflable, QGraphicsItem *parent, bool isView)
|
||||
: QGraphicsItem(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), hasCardAttr(_hasCardAttr), isShufflable(_isShufflable)
|
||||
{
|
||||
if (!isView)
|
||||
player->addZone(this);
|
||||
|
|
@ -109,26 +109,3 @@ void CardZone::moveAllToZone(const QString &targetZone, int targetX)
|
|||
for (int i = cards->size() - 1; i >= 0; i--)
|
||||
player->client->moveCard(cards->at(i)->getId(), getName(), targetZone, targetX);
|
||||
}
|
||||
|
||||
void CardZone::paintCardNumberEllipse(QPainter *painter)
|
||||
{
|
||||
painter->save();
|
||||
|
||||
QString numStr = QString::number(cards->size());
|
||||
QFont font("Times", 32, QFont::Bold);
|
||||
QFontMetrics fm(font);
|
||||
QRect br = fm.boundingRect(numStr);
|
||||
double w = br.width() * 1.42;
|
||||
double h = br.height() * 1.42;
|
||||
if (w < h)
|
||||
w = h;
|
||||
|
||||
painter->setPen(QPen(QColor("black")));
|
||||
painter->setBrush(QColor(255, 255, 255, 150));
|
||||
painter->drawEllipse(QRectF((boundingRect().width() - w) / 2.0, (boundingRect().height() - h) / 2.0, w, h));
|
||||
|
||||
painter->setFont(font);
|
||||
painter->drawText(boundingRect(), Qt::AlignCenter, numStr);
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue