Avoid detaches when iterating over QList without modifying


Use std::as_const in ranged-for or make const copies of the list before
iterating, and prefer element access with QList::at over operator[]. If
possible, pass elements through as const as well.

Amends 00393d5d9251fc85be401a89088edfb2a122b972 to address static
analyser warnings.

Axivion-Id: qt_Add-ons_qtcharts_dev_linux:SV821
Axivion-Id: qt_Add-ons_qtcharts_dev_linux:SV822
Pick-to: 6.12 6.11
Task-number: QTBUG-146050
Change-Id: I4cee614293f4d22d5b4727f9304ca94d13948cdb
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Sami Varanka <sami.varanka@qt.io>
commit7de275603a8d2565903919e183c353bab29cb1fc
parentd11211b73d686a65105c2c9a7950e3ffb8065bd0
authorVolker Hilsheimer <volker.hilsheimer@qt.io>
committerVolker Hilsheimer <volker.hilsheimer@qt.io>
commit timeWed, 24 Jun 2026 11:50:28 +0000