summaryrefslogtreecommitdiffstats
path: root/helper.cpp
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2018-11-24 17:17:08 +0100
committerArno <arno@disconnect.de>2018-11-24 17:17:08 +0100
commit2aef87d8f4d8050856e1f3bb713241ca4ffc2db9 (patch)
tree1c9855b96652ee9d599536264a220c23a8373d70 /helper.cpp
parentd8e62dd6e715fcc19b7e7d4d466a586c62ccc4e6 (diff)
downloadBeetPlayer-2aef87d8f4d8050856e1f3bb713241ca4ffc2db9.tar.gz
BeetPlayer-2aef87d8f4d8050856e1f3bb713241ca4ffc2db9.tar.bz2
BeetPlayer-2aef87d8f4d8050856e1f3bb713241ca4ffc2db9.zip
GUI changes
Play nice with themes, especially dark ones. Most likely the light icons will look crappy with a light theme, but theming support is another thing entirely. Right now I'm using a dark theme, so this is it...
Diffstat (limited to 'helper.cpp')
-rw-r--r--helper.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/helper.cpp b/helper.cpp
index 5fa3a3b..306a2d1 100644
--- a/helper.cpp
+++ b/helper.cpp
@@ -10,15 +10,19 @@
namespace Helper {
QIcon iconFromQChar(const QChar &c, int pixelSize){
- QPixmap pm(QSize(64,64));
- QPainter p(&pm);
- QFont f = p.font();
+ QImage img(32, 32, QImage::Format_ARGB32);
+ img.fill(QColor(0, 0, 0, 0));
+ QPainter p(&img);
+ p.setRenderHint(QPainter::Antialiasing);
+ p.setRenderHint(QPainter::TextAntialiasing);
+ p.setRenderHint(QPainter::SmoothPixmapTransform);
+ p.setPen(qApp->palette().color(QPalette::Text));
+ QFont f(qApp->font());
f.setPixelSize(pixelSize);
+ f.setBold(true);
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);
+ p.drawText(img.rect(), Qt::AlignCenter, c);
+ return QIcon(QPixmap::fromImage(img));
}
QAction* createSeparator(QObject *parent){