2D: Fix axis titles may overlap axis labels


Axis title placement did not account for QAbstractAxis::titleFont's
pixelSize: the space reserved for a title was a fixed 25px, and the
title was positioned using the previous frame's font metrics (setFont()
ran after the position was computed from the old size). With a title
font bigger than default, the title could overlap the axis labels, a
neighboring stacked axis, or spill outside the view.

Measure each axis title's height from its font metrics, and use it to:
- grow the gap reserved between a titled axis and whatever comes next
  (another axis or the outer view margin) beyond the default 25px when
  the title needs more room,
- offset the title outward from its default position by the extra
  height, so it grows away from the plot instead of into the labels,
- reserve extra space at the outermost edge when the title is taller
  than the view margin there.

Default-sized titles are unaffected, since the added offset/extra margin
is zero whenever the title fits in the existing 25px budget.

Authored with Claude

Pick-to: 6.12
Fixes: QTBUG-150641
Change-Id: I35e56d4dd4c2b1fe744a4f17871ccf5c68c34d20
Reviewed-by: Tomi Korpipaa <tomi.korpipaa@qt.io>
commit6a6685d23f90b8a56f0afc42c594c4e6a726552d
parentf9b45803bebafce2c9acd2ba8db118a08878729a
authorSami Varanka <sami.varanka@qt.io>
committerSami Varanka <sami.varanka@qt.io>
commit timeFri, 2 Oct 2026 06:44:54 +0000