From fd217e0513d450fc78345d6b040eda7893d815a8 Mon Sep 17 00:00:00 2001 From: Arno Date: Fri, 2 Feb 2018 03:43:45 +0100 Subject: 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. --- helper.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'helper.cpp') 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){ -- cgit v1.2.3-70-g09d2