| 177 | } |
| 178 | |
| 179 | static int iconIdForObject(const QMetaObject *mo, const QObject *obj) |
| 180 | { |
| 181 | static const IconDatabase iconDataBase = readIconData(); |
| 182 | |
| 183 | auto it = iconDataBase.constFind(QLatin1String(mo->className())); |
| 184 | if (it != iconDataBase.end()) { |
| 185 | for (const auto &propertyIcon : std::as_const(it->propertyIcons)) { |
| 186 | bool allMatch = true; |
| 187 | Q_ASSERT(!propertyIcon.second.isEmpty()); |
| 188 | for (const IconCacheEntry::PropertyPair &keyValue : std::as_const(propertyIcon.second)) { |
| 189 | if (stringifyProperty(obj, keyValue.first) != keyValue.second) { |
| 190 | allMatch = false; |
| 191 | break; |
| 192 | } |
| 193 | } |
| 194 | if (allMatch) |
| 195 | return propertyIcon.first; |
| 196 | } |
| 197 | return it->defaultIcon; |
| 198 | } |
| 199 | |
| 200 | if (mo->superClass()) |
| 201 | return iconIdForObject(mo->superClass(), obj); |
| 202 | |
| 203 | return -1; |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | int Util::iconIdForObject(const QObject *object) |
no test coverage detected