Fix incorrect spacing of settings icons at high DPI (#3698)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
kornes
2022-04-30 10:04:45 +00:00
committed by GitHub
parent 94e4cd2c1d
commit b825493d6e
2 changed files with 8 additions and 5 deletions
+7 -5
View File
@@ -57,15 +57,17 @@ void SettingsDialogTab::paintEvent(QPaintEvent *)
this->style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
int a = (this->height() - (20 * this->scale())) / 2;
int iconSize = 20 * this->scale();
int pad = (this->height() - iconSize) / 2;
QPixmap pixmap = this->ui_.icon.pixmap(
QSize(this->height() - a * 2, this->height() - a * 2));
QSize(this->height() - pad * 2, this->height() - pad * 2));
painter.drawPixmap(a, a, pixmap);
painter.drawPixmap(pad, pad, pixmap);
a = a + a + 20 + a;
pad = (3 * pad) + iconSize;
this->style()->drawItemText(&painter, QRect(a, 0, width() - a, height()),
this->style()->drawItemText(&painter,
QRect(pad, 0, width() - pad, height()),
Qt::AlignLeft | Qt::AlignVCenter,
this->palette(), false, this->ui_.labelText);
}