From 6dc9c8991923e9cd0bacf00a05742f0eea574ea5 Mon Sep 17 00:00:00 2001 From: Wang Peng Date: Wed, 4 Aug 2021 14:06:12 +0800 Subject: QStyle: allow styles to control the margin around icons in QLineEdit The styles can't control the margin of the icon container, and its value is hardcoded to a quarter of the iconSize, which is very unfriendly. Add a PixelMetric enum value to allow styles to control the margin. Change-Id: I21274b68d24150db7be78513fe9125f775aa2b00 Reviewed-by: Volker Hilsheimer --- src/widgets/styles/qcommonstyle.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/widgets/styles/qcommonstyle.cpp') diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index d784315ca7..6f6ddfec44 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -4807,6 +4807,9 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid case PM_LineEditIconSize: ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget); break; + case PM_LineEditIconMargin: + ret = proxy()->pixelMetric(PM_LineEditIconSize, opt, widget) / 4; + break; case PM_LargeIconSize: ret = int(QStyleHelper::dpiScaled(32, opt)); -- cgit v1.2.3