MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / data

Function data

launcher/ui/pages/instance/ScreenshotsPage.cpp:150–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148 }
149 virtual ~FilterModel() { m_thumbnailingPool.waitForDone(500); }
150 virtual QVariant data(const QModelIndex &proxyIndex, int role = Qt::DisplayRole) const
151 {
152 auto model = sourceModel();
153 if (!model)
154 return QVariant();
155 if (role == Qt::DisplayRole || role == Qt::EditRole)
156 {
157 QVariant result = sourceModel()->data(mapToSource(proxyIndex), role);
158 return result.toString().remove(QRegularExpression("\\.png$"));
159 }
160 if (role == Qt::DecorationRole)
161 {
162 QVariant result =
163 sourceModel()->data(mapToSource(proxyIndex), QFileSystemModel::FilePathRole);
164 QString filePath = result.toString();
165 QIcon temp;
166 if (!watched.contains(filePath))
167 {
168 ((QFileSystemWatcher &)watcher).addPath(filePath);
169 ((QSet<QString> &)watched).insert(filePath);
170 }
171 if (m_thumbnailCache->get(filePath, temp))
172 {
173 return temp;
174 }
175 if (!m_failed.contains(filePath))
176 {
177 ((FilterModel *)this)->thumbnailImage(filePath);
178 }
179 return (m_thumbnailCache->get("placeholder"));
180 }
181 return sourceModel()->data(mapToSource(proxyIndex), role);
182 }
183 virtual bool setData(const QModelIndex &index, const QVariant &value,
184 int role = Qt::EditRole)
185 {

Callers 7

mimeDataMethod · 0.85
infoRequestFinishedMethod · 0.85
dataMethod · 0.85
findMethod · 0.85
dataMethod · 0.85
dataMethod · 0.85
dataMethod · 0.85

Calls 6

insertMethod · 0.80
dataMethod · 0.45
removeMethod · 0.45
toStringMethod · 0.45
containsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected