blob: 91e4d7f4cea8e970f983504300bed546861a42b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include <QPainter>
#include <QPalette>
#include <QAction>
#include <QApplication>
#include "helper.h"
namespace Helper {
QIcon iconFromQChar(const QChar &c, int pixelSize){
QPixmap pm(QSize(64,64));
QPainter p(&pm);
QFont f = p.font();
f.setPixelSize(pixelSize);
p.setFont(f);
p.fillRect(pm.rect(), qApp->palette().color(QPalette::Window));
p.setBrush(QBrush(Qt::black));
p.drawText(pm.rect(), Qt::AlignCenter, c);
return QIcon(pm);
}
QAction* createSeparator(QObject *parent){
QAction *a = new QAction(parent);
a->setSeparator(true);
return a;
}
}
|