QDoc: Preserve caller's genus and domain hints for autolinks


When the legacy HtmlGenerator and DocBookGenerator encounter an
Atom::AutoLink, they pass Genus::API to the autolink resolver as an
explicit hint to consider only API trees (CPP, QML). The resolver's
findNodeForAtom honors that hint for plain atoms, but for LinkAtoms
it always reassigned the local genus and domain variables to the
LinkAtom's own values — even when those values came from an empty
square-bracket parameter list and carried no scoping intent.

The behavior went unnoticed while only the bracketed \l[scope]
form produced LinkAtoms. With plain \l, \sa, and autolink atoms
now also promoted to LinkAtom for source-location capture, the
override fires on every autolink. The Genus::API filter is lost,
the resolver scans across all genera, and bare words like "CMake"
in prose start matching anchors on unrelated DOC pages.

The override now applies only when the LinkAtom carries a non-default
hint — that is, when square-bracket parameters actually specified
a domain or genus. Empty parameters leave the caller's hint alone,
restoring the autolink resolution behavior that existed before plain
atoms became LinkAtoms.

Fixes: QTBUG-146721
Change-Id: Iaeb76a74d1f42a85a230c3f330be26a2123556dc
Reviewed-by: Topi Reinio <topi.reinio@qt.io>
commita13497c92b49a6896a69c65dc6fddea83a93625b
parent306e5689ef570330fd33f9fc54729dbf7c30fd3f
authorPaul Wicking <paul.wicking@qt.io>
committerPaul Wicking <paul.wicking@qt.io>
commit timeTue, 12 May 2026 11:07:40 +0000