QDoc: Use consistent ranking for link targets


A nearby section heading can replace a distant explicit target through
proximity, while the distant target can replace the nearby heading
through numeric priority. The result depends on candidate traversal
order.

This change ranks candidates by category, then numeric priority:
keywords first, closely related targets next, and other targets last.
When ranks are equal, the first candidate is preserved, including among
keywords.

The documentation for the function is updated accordingly to reflect the
selection order. A redundant `start` parameter and an unused capture are
dropped from local lambdas, and <utility> is included directly for
`std::pair`.

Fixes: QTBUG-150871
Pick-to: 6.12
Change-Id: I0d8d4a3d26b27794c27b339312c6eb3c3f46681e
Reviewed-by: Topi Reinio <topi.reinio@qt.io>
commitcff41040fa1fdc4c1cd957a7bf3e8d2ea23505c4
parentac5269884e5e5cbe000e10ff0b06ab013cbaf044
authorPaul Wicking <paul.wicking@qt.io>
committerPaul Wicking <paul.wicking@qt.io>
commit timeSat, 26 Sep 2026 07:38:55 +0000