#ifndef UIHELPER_H #define UIHELPER_H #include #include #include 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