QWindowsXPStyle: Enlarge QLineEdit/QComboBox when High DPI scaling is active.
In QWindowsXPStyle::sizeFromContents(), scale the margins using the devicePixelRatio and round the height up. Typically increases the height by 2 pixels when the device pixel ratio equals 2. Change-Id: I446ad518c3808a6454a08db7b66a942d37c1703f Task-number: QTBUG-49374 Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
This commit is contained in:
parent
5fb2dceab4
commit
cec15a89d0
@ -3793,10 +3793,12 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt
|
||||
{
|
||||
XPThemeData buttontheme(widget, 0, QWindowsXPStylePrivate::ButtonTheme, BP_PUSHBUTTON, PBS_NORMAL);
|
||||
if (buttontheme.isValid()) {
|
||||
const QMarginsF borderSize = buttontheme.margins() / QWindowsXPStylePrivate::devicePixelRatio(widget);
|
||||
const qreal devicePixelRatio = QWindowsXPStylePrivate::devicePixelRatio(widget);
|
||||
const QMarginsF borderSize = buttontheme.margins() / devicePixelRatio;
|
||||
if (!borderSize.isNull()) {
|
||||
sz.rwidth() += qRound(borderSize.left() + borderSize.right() - 2);
|
||||
sz.rheight() += qRound(borderSize.bottom() + borderSize.top() - 2);
|
||||
const qreal margin = qreal(2) / devicePixelRatio;
|
||||
sz.rwidth() += qRound(borderSize.left() + borderSize.right() - margin);
|
||||
sz.rheight() += int(borderSize.bottom() + borderSize.top() - margin + devicePixelRatio - 1);
|
||||
}
|
||||
const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin) + 1);
|
||||
sz += QSize(qMax(pixelMetric(QStyle::PM_ScrollBarExtent, option, widget)
|
||||
|
Loading…
Reference in New Issue
Block a user