From 25db59d7723c3d05ff55104768da31b0a7ce68ee Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 30 Jun 2016 08:48:52 +0200 Subject: [PATCH] Fix QLineEdit not showing clear button on macOS Restore code path returning the resource pixmap for platforms that do not have themes in QCommonStyle. Amends change b657496a0ba326af0688e9935069139c002849cf. Task-number: QTBUG-54425 Change-Id: I764408622b825b86afbe7ccf37e1498d3efb3850 Reviewed-by: Timur Pocheptsov --- src/widgets/styles/qcommonstyle.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 7b0d8eacd5c..6bf9d20b47d 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -5194,6 +5194,13 @@ static QPixmap cachedPixmapFromXPM(const char * const *xpm) return result; } +#ifndef QT_NO_IMAGEFORMAT_PNG +static inline QString clearText16IconPath() +{ + return QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-16.png"); +} +#endif // !QT_NO_IMAGEFORMAT_PNG + static QIcon clearTextIcon(bool rtl) { const QString directionalThemeName = rtl @@ -5206,7 +5213,7 @@ static QIcon clearTextIcon(bool rtl) QIcon icon; #ifndef QT_NO_IMAGEFORMAT_PNG - QPixmap clearText16(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-16.png")); + QPixmap clearText16(clearText16IconPath()); Q_ASSERT(!clearText16.size().isEmpty()); icon.addPixmap(clearText16); QPixmap clearText32(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-32.png")); @@ -5521,6 +5528,8 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-16.png")); case SP_MediaVolumeMuted: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png")); + case SP_LineEditClearButton: + return QPixmap(clearText16IconPath()); #endif // QT_NO_IMAGEFORMAT_PNG default: break;