diff options
author | Arno <arno@disconnect.de> | 2018-11-24 17:17:08 +0100 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2018-11-24 17:17:08 +0100 |
commit | 2aef87d8f4d8050856e1f3bb713241ca4ffc2db9 (patch) | |
tree | 1c9855b96652ee9d599536264a220c23a8373d70 /helper.cpp | |
parent | d8e62dd6e715fcc19b7e7d4d466a586c62ccc4e6 (diff) | |
download | BeetPlayer-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.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -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){ |