比较漂亮的实例
#include "iconhelper.h"
IconHelper* IconHelper::_instance = 0;
IconHelper::IconHelper(QObject*):
QObject(qApp)
{
int fontId = QFontDatabase::addApplicationFont(":/image/fontawesome-webfont.ttf");
QString fontName = QFontDatabase::applicationFontFamilies(fontId).at(0);
iconFont = QFont(fontName);
}
void IconHelper::SetIcon(QLabel* lab, QChar c, int size)
{
iconFont.setPointSize(size);
lab->setFont(iconFont);
lab->setText(c);
}
void IconHelper::SetIcon(QPushButton* btn, QChar c, int size)
{
iconFont.setPointSize(size);
btn->setFont(iconFont);
btn->setText(c);
}
2019-12-21 20:19:34
930KB
qss,qt
1