QDoc: Compute cross-module template hrefs from actual output paths
Template-generated pages rely on a href resolver to turn a node plus
its referring context into a relative link. For cross-module links,
the resolver used to prepend a fixed \c ../<module>/ prefix whenever
per-module subdirs were enabled, and it separately stripped the same
kind of prefix off URLs carrying it when subdirs were disabled. Both
paths baked a specific layout depth into the resolver: one assumed
the current page is exactly one directory below the module root, the
other assumed the dependency's output sits side-by-side with the
current module's output. Any qdocconf that adds a format
subdirectory on top of the per-module layout — the shape the
template generator uses for snapshot deploys — ends up one level
deeper than either path expects, and cross-module links render
pointing at directories that don't exist.
The resolver now derives the cross-module prefix from the output
paths it already has. Given the current page's output directory
from OutputContext, the target module's output directory is
constructed by swapping the current module's name for the target's
in that path, and the href prefix is the QDir::relativeFilePath
between the two. URLs carrying a scheme still pass through as
external references; URLs loaded from a dependency's .index are
reduced to their filename stem and then routed through the same
path-based prefix computation, so the resolver produces a
depth-correct link regardless of whether the consumer uses flat
output, per-module subdirs, a format subdirectory, or both together.
Task-number: QTBUG-143488
Change-Id: I7612c677ca4228307edfc655548aa9e545ad58a5
Reviewed-by: Topi Reinio <topi.reinio@qt.io>