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 b657496a0b.

Task-number: QTBUG-54425
Change-Id: I764408622b825b86afbe7ccf37e1498d3efb3850
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
This commit is contained in:
Friedemann Kleint 2016-06-30 08:48:52 +02:00
parent c376e3fbf0
commit 25db59d772

View File

@ -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;