2018-09-14 09:45:05 +00:00
|
|
|
#include <QPixmap>
|
|
|
|
#include <QPainter>
|
|
|
|
#include "markiconcreator.h"
|
|
|
|
#include "theme.h"
|
|
|
|
|
2018-10-25 00:19:38 +00:00
|
|
|
std::map<BoneMark, QIcon> MarkIconCreator::m_iconMap;
|
2018-09-14 09:45:05 +00:00
|
|
|
int MarkIconCreator::m_iconSize = 40;
|
|
|
|
|
2018-10-25 00:19:38 +00:00
|
|
|
QIcon MarkIconCreator::createIcon(BoneMark boneMark)
|
2018-09-14 09:45:05 +00:00
|
|
|
{
|
|
|
|
if (m_iconMap.find(boneMark) == m_iconMap.end()) {
|
|
|
|
QPixmap pixmap(MarkIconCreator::m_iconSize, MarkIconCreator::m_iconSize);
|
|
|
|
pixmap.fill(Qt::transparent);
|
2018-10-25 00:19:38 +00:00
|
|
|
QColor color = BoneMarkToColor(boneMark);
|
2018-09-14 09:45:05 +00:00
|
|
|
QPainter painter(&pixmap);
|
|
|
|
painter.setBrush(QBrush(color));
|
|
|
|
painter.setPen(Qt::NoPen);
|
|
|
|
painter.drawEllipse(0, 0, MarkIconCreator::m_iconSize, MarkIconCreator::m_iconSize);
|
|
|
|
QIcon icon(pixmap);
|
|
|
|
m_iconMap[boneMark] = icon;
|
|
|
|
}
|
|
|
|
return m_iconMap[boneMark];
|
|
|
|
}
|