mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
nicer looking counters on cards
This commit is contained in:
parent
f33abf14ca
commit
9f79bd2c8e
5 changed files with 12 additions and 7 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#include "abstractgraphicsitem.h"
|
||||
#include <QPainter>
|
||||
|
||||
void AbstractGraphicsItem::paintNumberEllipse(int number, int fontSize, const QColor &color, int position, QPainter *painter)
|
||||
void AbstractGraphicsItem::paintNumberEllipse(int number, int fontSize, const QColor &color, int position, int count, QPainter *painter)
|
||||
{
|
||||
painter->save();
|
||||
|
||||
|
|
@ -31,8 +31,13 @@ void AbstractGraphicsItem::paintNumberEllipse(int number, int fontSize, const QC
|
|||
if (position == -1)
|
||||
textRect = QRectF((boundingRect().width() - w) / 2.0, (boundingRect().height() - h) / 2.0, w, h);
|
||||
else {
|
||||
qreal offset = boundingRect().width() / 20.0;
|
||||
textRect = QRectF(offset, offset * (position + 1) + h * position, w, h);
|
||||
qreal xOffset = 10;
|
||||
qreal yOffset = 20;
|
||||
qreal spacing = 2;
|
||||
if (position < 2)
|
||||
textRect = QRectF(count == 1 ? ((boundingRect().width() - w) / 2.0) : (position % 2 == 0 ? xOffset : (boundingRect().width() - xOffset - w)), yOffset, w, h);
|
||||
else
|
||||
textRect = QRectF(count == 3 ? ((boundingRect().width() - w) / 2.0) : (position % 2 == 0 ? xOffset : (boundingRect().width() - xOffset - w)), yOffset + (spacing + h) * (position / 2), w, h);
|
||||
}
|
||||
|
||||
painter->drawEllipse(textRect);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue