mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-14 19:18:55 -07:00
started implementing deck printing
This commit is contained in:
parent
fb03c5cdbb
commit
33cc7a8859
7 changed files with 87 additions and 6 deletions
|
|
@ -62,11 +62,21 @@ void CardItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
|||
painter->drawRect(QRectF(0.5, 0.5, CARD_WIDTH - 1, CARD_HEIGHT - 1));
|
||||
}
|
||||
if (counters) {
|
||||
painter->setFont(QFont("Times", 32, QFont::Bold));
|
||||
painter->setPen(QPen(Qt::black));
|
||||
painter->setBackground(QBrush(QColor(255, 255, 255, 100)));
|
||||
painter->setBackgroundMode(Qt::OpaqueMode);
|
||||
painter->drawText(boundingRect(), Qt::AlignCenter, QString::number(counters));
|
||||
QString numStr = QString::number(counters);
|
||||
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(Qt::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