| 123 | } |
| 124 | |
| 125 | void MetaObjectBrowser::doProblemScan(const QMetaObject *parent) |
| 126 | { |
| 127 | auto registry = Probe::instance()->metaObjectRegistry(); |
| 128 | |
| 129 | const QVector<const QMetaObject *> metaObjects = registry->childrenOf(parent); |
| 130 | |
| 131 | for (const QMetaObject *mo : metaObjects) { |
| 132 | if (!registry->isValid(mo) || !registry->isStatic(mo)) |
| 133 | continue; |
| 134 | |
| 135 | auto results = QMetaObjectValidator::check(mo); |
| 136 | if (results != QMetaObjectValidatorResult::NoIssue) { |
| 137 | // TODO do we want the Problem descriptions have more detail, i.e. have one problem listed |
| 138 | // for each method/property that has issues instead of one for each metaobject? |
| 139 | Problem p; |
| 140 | p.severity = Problem::Warning; |
| 141 | QStringList issueList; |
| 142 | |
| 143 | if (results & QMetaObjectValidatorResult::SignalOverride) |
| 144 | issueList.push_back(QStringLiteral("overrides base class signal")); |
| 145 | if (results & QMetaObjectValidatorResult::UnknownMethodParameterType) |
| 146 | issueList.push_back(QStringLiteral("uses a parameter type not registered with the meta type system")); |
| 147 | if (results & QMetaObjectValidatorResult::PropertyOverride) |
| 148 | issueList.push_back(QStringLiteral("overrides base class property")); |
| 149 | if (results & QMetaObjectValidatorResult::UnknownPropertyType) |
| 150 | issueList.push_back(QStringLiteral("has a property with a type not registered with the meta type system")); |
| 151 | |
| 152 | p.description = QStringLiteral("%1 %2.").arg(mo->className(), issueList.join(QStringLiteral(", "))); |
| 153 | p.object = ObjectId(const_cast<QMetaObject *>(mo), "const QMetaObject*"); |
| 154 | p.problemId = QStringLiteral("com.kdab.GammaRay.MetaObjectBrowser.QMetaObjectValidator:%1").arg(reinterpret_cast<quintptr>(mo)); |
| 155 | p.findingCategory = Problem::Scan; |
| 156 | ProblemCollector::addProblem(p); |
| 157 | } |
| 158 | |
| 159 | doProblemScan(mo); |
| 160 | } |
| 161 | } |
nothing calls this directly
no test coverage detected