QDoc: Preserve section anchors in resolved links
Documentation frequently cross-references named sections of a page.
A link such as \l{SomePage#Section Title} is meant to drop the
reader right at that heading, not at the top of the destination
document. In the template generator, though, these links land at
the page's top because link resolution returns the destination node
without carrying forward the anchor fragment the database already
computed during the lookup.
Link resolution now passes the anchor back out of the database and
appends it to the generated URL, mirroring the legacy HTML
generator's autolink path. Existing fixtures were regenerated to
capture the restored anchors across example pages, QML overviews,
and navigation chrome, giving the fix continuous coverage without
adding a bespoke test case.
Fixes: QTBUG-145940
Change-Id: I36540f2b97705144a84df83b9d5587a015110ccd
Reviewed-by: Topi Reinio <topi.reinio@qt.io>
| commit | 14b8e35add059aac94d384ee4d03e05b93c1dc1f |
| parent | 0c269e26ff3eb0b85fc097d0eff4e2c7ae024424 |
| author | Paul Wicking <paul.wicking@qt.io> |
| committer | Paul Wicking <paul.wicking@qt.io> |
| commit time | Wed, 22 Apr 2026 07:48:19 +0000 |
- M src/qdoc/qdoc/src/qdoc/linkresolver.cpp
- M src/qdoc/qdoc/src/qdoc/qdocdatabase.cpp
- M src/qdoc/qdoc/src/qdoc/qdocdatabase.h
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/cppref_validation/expected/html/qtcoap-index.html
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/cppref_validation/expected/html/qtcoap-quickmulticastclient-example.html
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/cppref_validation/expected/html/qtcoap-quicksecureclient-example.html
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/cppref_validation/expected/markdown/qtcoap-index.md
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/cppref_validation/expected/markdown/qtcoap-quickmulticastclient-example.md
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/cppref_validation/expected/markdown/qtcoap-quicksecureclient-example.md
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/navigation/expected/html/testnavigation-module.html
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/html/qml-qt-labs-lottieqt-lottieanimation.html
- M src/qdoc/qdoc/tests/validatetemplategeneratoroutput/testdata/qtlottie_validation/expected/markdown/qml-qt-labs-lottieqt-lottieanimation.md