QDoc: Respect nosubdirs when emitting index-loaded URLs


Documentation pages linking to content from another module — a QML
type listing its subclasses in the "Inherited By" field, for example —
rely on URLs read from that other module's index file. The index
reader prepends a relative subdirectory to those URLs so the resulting
link lands in the nested output layout QDoc has traditionally used,
one directory per module. When the consuming project is instead built
with the format's \c{nosubdirs} option enabled, pages share a single
flat output directory and the subdirectory prefix in an index-loaded
URL no longer corresponds to anything on disk. Browsers follow the
link into a nonexistent directory and readers see a broken page.

The href resolver now strips the leading path component from such
URLs when emitting them under a flat layout, preserving the filename
while discarding the layout assumption the index reader baked in.
External URLs carrying a scheme are untouched, so linked content on
other sites still resolves correctly. Readers using the template
generator with a flat output structure now reach the right page
regardless of which module originally authored the target.

Fixes: QTBUG-145899
Change-Id: I7b05318f389361b4d81c5cae63e588dd51f0634c
Reviewed-by: Topi Reinio <topi.reinio@qt.io>
commitc5d77f2b389accab7da2ce1bbf0212b118723f7d
parent02ea63114d51cdcab4833de2c899fb374efcf2e1
authorPaul Wicking <paul.wicking@qt.io>
committerPaul Wicking <paul.wicking@qt.io>
commit timeTue, 21 Apr 2026 12:58:13 +0000