QIconCacheGtkReader: use QStringRef more
lookup() method now takes QStringRef arg. Reduce allocations. Change-Id: I556d01be5c5f268672121ab4c67c652cb6cfe090 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
parent
6621e6f89a
commit
d2f6f66a03
@ -168,7 +168,7 @@ class QIconCacheGtkReader
|
||||
{
|
||||
public:
|
||||
explicit QIconCacheGtkReader(const QString &themeDir);
|
||||
QVector<const char *> lookup(const QString &);
|
||||
QVector<const char *> lookup(const QStringRef &);
|
||||
bool isValid() const { return m_isValid; }
|
||||
private:
|
||||
QFile m_file;
|
||||
@ -241,7 +241,7 @@ static quint32 icon_name_hash(const char *p)
|
||||
with this name is present. The char* are pointers to the mapped data.
|
||||
For example, this would return { "32x32/apps", "24x24/apps" , ... }
|
||||
*/
|
||||
QVector<const char *> QIconCacheGtkReader::lookup(const QString &name)
|
||||
QVector<const char *> QIconCacheGtkReader::lookup(const QStringRef &name)
|
||||
{
|
||||
QVector<const char *> ret;
|
||||
if (!isValid())
|
||||
@ -394,7 +394,7 @@ QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName,
|
||||
|
||||
const QStringList contentDirs = theme.contentDirs();
|
||||
|
||||
QString iconNameFallback = iconName;
|
||||
QStringRef iconNameFallback(&iconName);
|
||||
|
||||
// Iterate through all icon's fallbacks in current theme
|
||||
while (info.entries.isEmpty()) {
|
||||
@ -451,7 +451,7 @@ QThemeIconInfo QIconLoader::findIconHelper(const QString &themeName,
|
||||
}
|
||||
|
||||
if (!info.entries.isEmpty()) {
|
||||
info.iconName = iconNameFallback;
|
||||
info.iconName = iconNameFallback.toString();
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user