mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
converted phases toolbar to graphics item
This commit is contained in:
parent
20194617bc
commit
78e5068e39
24 changed files with 274 additions and 159 deletions
|
|
@ -5,6 +5,24 @@
|
|||
#include <math.h>
|
||||
#include <QDebug>
|
||||
|
||||
QMap<QString, QPixmap> PhasePixmapGenerator::pmCache;
|
||||
|
||||
QPixmap PhasePixmapGenerator::generatePixmap(int height, QString name)
|
||||
{
|
||||
QString key = name + QString::number(height);
|
||||
if (pmCache.contains(key))
|
||||
return pmCache.value(key);
|
||||
|
||||
QSvgRenderer svg(QString(":/resources/phases/icon_phase_" + name + ".svg"));
|
||||
|
||||
QPixmap pixmap(height, height);
|
||||
pixmap.fill(Qt::transparent);
|
||||
QPainter painter(&pixmap);
|
||||
svg.render(&painter, QRectF(0, 0, height, height));
|
||||
pmCache.insert(key, pixmap);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
QMap<QString, QPixmap> CounterPixmapGenerator::pmCache;
|
||||
|
||||
QPixmap CounterPixmapGenerator::generatePixmap(int height, QString name, bool highlight)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue