QDoc: Preserve enum declaration scope with relates


When a nonmember is documented with the `\relates` command, it
moves to the page of the related class. However, in doing so, the
reparenting operation causes QDoc to qualify the scope using the
new (not originating/declaring) parent. This is wrong: a constant
of an enum declared in a namespace displays with the related class's
name instead of its namespace, and a constant of an enum
declared in the global namespace displays with a scope that
doesn't exist.

With this change, an adopted nonmember remembers the aggregate in
whose scope it was declared. Enum value listings in the HTML,
WebXML, and DocBook outputs qualify the values with that declaration
scope. The values keep their links, anchors, and placement on the
related class's page, and enums that are not related are unaffected.

The added test case documents a related scoped enum, a related
unscoped enum, and a related global enum, and checks the constant
spellings in all three output formats.

Fixes: QTBUG-150820
Pick-to: 6.12
Change-Id: Id911a9aa7e76d570af2bc6a8a56732521a832518
Reviewed-by: David Boddie <david.boddie@qt.io>
commitbbf76d83a309731e04274dae20c5242fa3f1fed7
parent957fbac33899fc5c2939237d53d0a1a2b2eed534
authorPaul Wicking <paul.wicking@qt.io>
committerPaul Wicking <paul.wicking@qt.io>
commit timeFri, 2 Oct 2026 16:52:37 +0000