resourcecheck
The check that each Qt resource path in the source is declared in a .qrc file, and that each static library registers its .qrc files.
| Group | tools |
Detailed description
The resource-check host tool runs this scan as a build step, and testResourceRegistration runs it as a test. Both call the same functions, so the two give one answer. The namespace holds the scan, the list of vendored trees that it skips, and the helpers that blank comments and normalize a resource path the way Qt does.
Function documentation
normaliseResourcePath
QString resourcecheck::normaliseResourcePath(const QString &p)
Normalise the resource path p the way Qt itself does before lookup.
`QResourcePrivate::load()` calls a local `cleanPath()` which runs `QDir::cleanPath` and then explicitly collapses a leading `//` to `/` (qtbase/src/corelib/io/qresource.cpp:165-172, Qt 6.10.1, read from source). So `"://zootpl/admin_index.mtpl"` resolves to `:/zootpl/admin_index.mtpl` at run time and is NOT broken.
This check compares strings rather than resolving them, so without matching Qt's normalisation it reports a working reference as a missing one — and it did, for the one site in the tree that spells it that way.
stripComments
QString resourcecheck::stripComments(const QString &src)
Blank the C++ comments in src, preserving everything else.
A `":/…"` inside a comment is not a reference to anything. Three of this check's findings were exactly that, and each cost someone a look:
· NameGenerator.hpp:73 — `@param resourcePath Qt resource path (e.g., ":/wordlists/custom.txt")`. A Doxygen EXAMPLE. · The `§GR-2.3` note in GradientLibrary.cpp naming the resource route that was struck from the spec. · The test's own prose, once it started naming the paths it had flagged.
Same lesson as Stream Discipline's Class C/D split, reached from the other end: match on BEHAVIOUR, not on text. A guard whose findings must be hand-triaged stops being read, which this check already knew — it excludes .qsb because reporting build artefacts was 37 of its first 46 findings.