initial commit

This commit is contained in:
kazu
2016-05-24 16:55:19 +02:00
commit 13a89df8d6
77 changed files with 7454 additions and 0 deletions

32
UIHelper.h Normal file
View File

@@ -0,0 +1,32 @@
#ifndef UIHELPER_H
#define UIHELPER_H
#include <QImage>
#include <QPainter>
#include <QtSvg/QSvgRenderer>
class UIHelper {
public:
// static QIcon getIcon(const std::string& name) {
// const std::string file = "://res/icons/" + name + "16.png";
// QPixmap img(file.c_str());
// return QIcon(img);
// }
static QIcon getIcon(const std::string& name) {
const int size = 32;
const QColor fill = Qt::transparent;
const std::string file = "://res/icons/" + name + ".svg";
QSvgRenderer renderer(QString(file.c_str()));
QPixmap pm(size, size);
pm.fill(fill);
QPainter painter(&pm);
renderer.render(&painter, pm.rect());
return QIcon(pm);
}
};
#endif // UIHELPER_H