Add Style hint for Clear buttons within QLineEdit.

Initial-patch-by: Kevin.Ottens@kdab.com

Change-Id: I4893923d5015535eb6d934636d6b5925088d7be8
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
This commit is contained in:
Friedemann Kleint 2013-04-08 10:08:19 +02:00 committed by The Qt Project
parent 12d8264a24
commit 0e9ea64edc
5 changed files with 12 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 B

View File

@ -5289,6 +5289,13 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
}
}
break;
case SP_LineEditClearButton: {
QString themeName = rtl ? QStringLiteral("edit-clear-locationbar-ltr") : QStringLiteral("edit-clear-locationbar-rtl");
if (!QIcon::hasThemeIcon(themeName))
themeName = QStringLiteral("edit-clear");
pixmap = QIcon::fromTheme(themeName).pixmap(16);
}
break;
default:
break;
}
@ -5417,6 +5424,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(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-16.png"));
#endif // QT_NO_IMAGEFORMAT_PNG
default:
break;

View File

@ -1986,6 +1986,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value SP_MediaSeekBackward Icon indicating that media should seek backward.
\value SP_MediaVolume Icon indicating a volume control.
\value SP_MediaVolumeMuted Icon indicating a muted volume control.
\value SP_LineEditClearButton Icon for a standard clear button in a QLineEdit. This enum value was added in Qt 5.2.
\value SP_CustomBase Base value for custom standard pixmaps;
custom values must be greater than this value.

View File

@ -777,6 +777,7 @@ public:
SP_MediaSeekBackward,
SP_MediaVolume,
SP_MediaVolumeMuted,
SP_LineEditClearButton,
// do not add any values below/greater than this
SP_CustomBase = 0xf0000000
};

View File

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/qt-project.org/styles/commonstyle">
<file>images/cleartext-16.png</file>
<file>images/filelink-16.png</file>
<file>images/filelink-32.png</file>
<file>images/filelink-128.png</file>