Skip to content

use stl-style and ranged-for iteration for variant containers#48322

Merged
jkarneges merged 1 commit intomainfrom
jkarneges/variant-iter
Apr 10, 2026
Merged

use stl-style and ranged-for iteration for variant containers#48322
jkarneges merged 1 commit intomainfrom
jkarneges/variant-iter

Conversation

@jkarneges
Copy link
Copy Markdown
Member

@jkarneges jkarneges commented Apr 10, 2026

#48320 mentions that iterating variant containers still involves working with types like QHashIterator. Qt's foreach macro is also used when looping over variant lists. This PR changes all variant iterator usage to STL-style (begin()/end()), and replaces all variant-related foreach loops with standard ranged for loops (i.e. for(element : collection)).

After this, all variant usage will be free of direct references to Qt, except for when working with APIs that specifically require QVariant, such as QSettings and QJson. And of course, custom variant types still require Q_DECLARE_METATYPE.

@jkarneges jkarneges requested a review from a team April 10, 2026 18:53
@jkarneges jkarneges merged commit ee8d03f into main Apr 10, 2026
19 checks passed
@jkarneges jkarneges deleted the jkarneges/variant-iter branch April 10, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants