From 5df0f97d2f4f90decbc2fb263704755857416846 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Mon, 24 Jul 2017 19:29:51 +0200 Subject: [PATCH] Core: Tweak the wizard icon text overlay Increasing the text size a bit, making the text darker and making the margin proportional to the image size (resolution independent). Change-Id: I029b57e2bf1c355f35161e5f8810dddea4114047 Reviewed-by: Tim Jenssen --- src/plugins/coreplugin/dialogs/newdialog.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/coreplugin/dialogs/newdialog.cpp b/src/plugins/coreplugin/dialogs/newdialog.cpp index 6ffb1e89b7d..2254f6c5b62 100644 --- a/src/plugins/coreplugin/dialogs/newdialog.cpp +++ b/src/plugins/coreplugin/dialogs/newdialog.cpp @@ -376,14 +376,16 @@ static QIcon iconWithText(const QIcon &icon, const QString &text) QIcon iconWithText; for (const QSize &pixmapSize : icon.availableSizes()) { QPixmap pixmap = icon.pixmap(pixmapSize); + const int fontSize = pixmap.height() / 4; + const int margin = pixmap.height() / 8; QFont font; - font.setPixelSize(qMin(pixmap.height(), pixmap.width()) / 5); + font.setPixelSize(fontSize); + font.setStretch(85); QPainter p(&pixmap); - p.setPen(qRgb(0x6b, 0x70, 0x80)); p.setFont(font); QTextOption textOption(Qt::AlignHCenter | Qt::AlignBottom); textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); - p.drawText(pixmap.rect().adjusted(9, 10, -9, -10), text, textOption); + p.drawText(pixmap.rect().adjusted(margin, margin, -margin, -margin), text, textOption); iconWithText.addPixmap(pixmap); } return iconWithText;