summaryrefslogtreecommitdiffstats
path: root/helper.cpp
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2018-02-02 03:43:45 +0100
committerArno <arno@disconnect.de>2018-02-02 03:43:45 +0100
commitfd217e0513d450fc78345d6b040eda7893d815a8 (patch)
tree45504ac927ad58b9a43251426aec84a8bad9058f /helper.cpp
parent9dd407fe739e1ba469b17d2977feabe3130d4e57 (diff)
downloadShemovCleaner-fd217e0513d450fc78345d6b040eda7893d815a8.tar.gz
ShemovCleaner-fd217e0513d450fc78345d6b040eda7893d815a8.tar.bz2
ShemovCleaner-fd217e0513d450fc78345d6b040eda7893d815a8.zip
Show actors in SearchDialog
This should have been two commits, really. One for the actors, and another one for the icon helper. Helper::icon returns an QIcon with a circle in bg color and the char c.
Diffstat (limited to 'helper.cpp')
-rw-r--r--helper.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/helper.cpp b/helper.cpp
index 502bfac..2dafaa4 100644
--- a/helper.cpp
+++ b/helper.cpp
@@ -136,6 +136,25 @@ namespace Helper {
return retval;
}
+ const QIcon icon(const QColor &bg, const QChar c){
+ QImage img(32, 32, QImage::Format_ARGB32);
+ img.fill(QColor(0, 0, 0, 0));
+ QPainter *p = new QPainter(&img);
+ p->setBrush(bg);
+ p->setRenderHint(QPainter::Antialiasing);
+ p->setRenderHint(QPainter::TextAntialiasing);
+ p->setRenderHint(QPainter::SmoothPixmapTransform);
+ QFont f("courier new");
+ f.setPixelSize(32);
+ f.setBold(true);
+ p->setPen(Qt::white);
+ p->drawEllipse(img.rect());
+ p->setFont(f);
+ p->drawText(img.rect(), Qt::AlignCenter, c);
+ delete p;
+ return QIcon(QPixmap::fromImage(img));
+ }
+
Duration::Duration() : mHours(0), mMinutes(0), mSeconds(0) {}
Duration::Duration(qint64 seconds){