mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 09:05:10 -07:00
Some checks are pending
CodeQL / Analyze (cpp) (push) Waiting to run
CodeQL / Analyze (actions) (push) Waiting to run
Build Desktop / Configure (push) Waiting to run
Build Desktop / Debian 13 (push) Blocked by required conditions
Build Desktop / Debian 12 (push) Blocked by required conditions
Build Desktop / Fedora 44 (push) Blocked by required conditions
Build Desktop / Fedora 43 (push) Blocked by required conditions
Build Desktop / Servatrice_Debian 12 (push) Blocked by required conditions
Build Desktop / Ubuntu 26.04 (push) Blocked by required conditions
Build Desktop / Ubuntu 24.04 (push) Blocked by required conditions
Build Desktop / Arch (push) Blocked by required conditions
Build Desktop / macOS 13 Intel (push) Blocked by required conditions
Build Desktop / macOS 14 (push) Blocked by required conditions
Build Desktop / macOS 15 (push) Blocked by required conditions
Build Desktop / macOS 26 Debug (push) Blocked by required conditions
Build Desktop / Windows 10 (push) Blocked by required conditions
Build Docker / Servatrice (arm) (push) Waiting to run
Build Docker / Servatrice (x86) (push) Waiting to run
Build Docker / Publish multi-platform Servatrice image (push) Blocked by required conditions
Replace remaining QPixmap("theme:...") call sites with themePixmap() so icons, replay controls, card backs, and other images resolve to -dark/-light variants under theme schemes. Stem-exact 1:1 migration; behavior unchanged for non-variant themes.
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
#include "hand_counter.h"
|
|
|
|
#include "../interface/pixel_map_generator.h"
|
|
#include "zones/card_zone.h"
|
|
|
|
#include <QGraphicsSceneMouseEvent>
|
|
#include <QPainter>
|
|
#include <QPixmapCache>
|
|
|
|
HandCounter::HandCounter(QGraphicsItem *parent) : AbstractGraphicsItem(parent), number(0)
|
|
{
|
|
setCacheMode(DeviceCoordinateCache);
|
|
}
|
|
|
|
HandCounter::~HandCounter()
|
|
{
|
|
}
|
|
|
|
void HandCounter::updateNumber()
|
|
{
|
|
number = static_cast<CardZoneLogic *>(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->save();
|
|
QSize translatedSize = painter->combinedTransform().mapRect(boundingRect()).size().toSize();
|
|
QPixmap cachedPixmap;
|
|
if (!QPixmapCache::find("handCounter" + QString::number(translatedSize.width()), &cachedPixmap)) {
|
|
cachedPixmap =
|
|
themePixmap(QStringLiteral("hand")).scaled(translatedSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
|
QPixmapCache::insert("handCounter" + QString::number(translatedSize.width()), cachedPixmap);
|
|
}
|
|
resetPainterTransform(painter);
|
|
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();
|
|
}
|
|
}
|