Merge "Add setting the ICON size attribute in lineedit to the style plugin"

This commit is contained in:
Tang Haixiang 2021-03-08 19:49:44 +08:00 committed by Qt CI Bot
commit ae88dea1be
5 changed files with 12 additions and 1 deletions

View File

@ -4828,6 +4828,9 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
case PM_IconViewIconSize:
ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget);
break;
case PM_LineEditIconSize:
ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);
break;
case PM_LargeIconSize:
ret = int(QStyleHelper::dpiScaled(32, opt));

View File

@ -3045,6 +3045,9 @@ int QFusionStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, co
case PM_ListViewIconSize:
val = 24;
break;
case PM_LineEditIconSize:
val = 24;
break;
case PM_DialogButtonsSeparator:
case PM_ScrollBarSliderMin:
val = 26;

View File

@ -1516,6 +1516,9 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value PM_TitleBarButtonSize The size of buttons on a title bar.
This enum value has been introduced in Qt 5.8.
\value PM_LineEditIconSize The default size for icons in a line edit.
This enum value has been introduced in Qt 6.2.
\value PM_CustomBase Base value for custom pixel metrics. Custom
values must be greater than this value.

View File

@ -567,6 +567,8 @@ public:
PM_TitleBarButtonIconSize,
PM_TitleBarButtonSize,
PM_LineEditIconSize,
// do not add any values below/greater than this
PM_CustomBase = 0xf0000000
};

View File

@ -495,7 +495,7 @@ QLineEditPrivate::SideWidgetParameters QLineEditPrivate::sideWidgetParameters()
{
Q_Q(const QLineEdit);
SideWidgetParameters result;
result.iconSize = q->style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, q);
result.iconSize = q->style()->pixelMetric(QStyle::PM_LineEditIconSize, nullptr, q);
result.margin = result.iconSize / 4;
result.widgetWidth = result.iconSize + 6;
result.widgetHeight = result.iconSize + 2;