summaryrefslogtreecommitdiffstats
path: root/helper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'helper.cpp')
-rw-r--r--helper.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/helper.cpp b/helper.cpp
new file mode 100644
index 0000000..91e4d7f
--- /dev/null
+++ b/helper.cpp
@@ -0,0 +1,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;
+ }
+}