MCPcopy Create free account
hub / github.com/KDAB/GammaRay / themedFilePath

Function themedFilePath

ui/uiresources.cpp:115–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115QString themedFilePath(ThemeEntryType type, UIResources::Theme theme, const QString &filePath, QWidget *widget)
116{
117 const PairThemeFileName pair = { devicePixelRatio(widget), theme, filePath };
118 HashedThemeFilePaths &hash(s_cachedFilePaths[type]);
119 auto it = hash.find(pair);
120
121 if (it == hash.end()) {
122 const QString iconFilePath = QString::fromLatin1("%1/%2")
123 .arg(type == Pixmap ? QStringLiteral("pixmaps") : QStringLiteral("icons"), filePath);
124 QString candidate(UIResources::themedPath(theme, iconFilePath, widget));
125
126 // Fallback to default theme file
127 if (theme != UIResources::Default && !QFile::exists(candidate)) {
128 const QString fallback = UIResources::themedFilePath(type, UIResources::Default, filePath, widget);
129 if (QFile::exists(fallback))
130 candidate = fallback;
131 }
132
133 it = hash.insert(pair, candidate);
134 // Q_ASSERT_X(QFile::exists(*it), "themedFilePath", qPrintable(*it));
135 }
136
137 return *it;
138}
139}
140}
141

Callers 4

themedIconMethod · 0.85
themedPixmapMethod · 0.85
themedImageMethod · 0.85
themedFilePathMethod · 0.85

Calls 4

devicePixelRatioFunction · 0.85
themedPathFunction · 0.85
endMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected