Fix the appearance of QSpinBox arrows on high-DPI displays

A previous change to QLineEdit::sizeHint() has caused the QSpinBox
arrows to break the widget frame on a high-DPI display with some
particular scale values like 150 or 175%. This change updates
QLineEdit::sizeHint() so that it has a minimum height, using the same
values used in 5.11.

Fixes: QTBUG-76047
Change-Id: I21f3e736da473b10fdf52e5a60e5fc5d07f270a1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Andre de la Rocha 2019-06-04 18:30:17 +02:00
parent 78caba7ae6
commit a4718f1274

View File

@ -684,7 +684,7 @@ QSize QLineEdit::sizeHint() const
ensurePolished();
QFontMetrics fm(font());
const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);
int h = qMax(fm.height(), iconSize - 2) + 2*d->verticalMargin
int h = qMax(fm.height(), qMax(14, iconSize - 2)) + 2*d->verticalMargin
+ d->topTextMargin + d->bottomTextMargin
+ d->topmargin + d->bottommargin;
int w = fm.horizontalAdvance(QLatin1Char('x')) * 17 + 2*d->horizontalMargin