Skip to content

add variant type aliases, as preparation to migrate away from QVariant#48319

Merged
jkarneges merged 1 commit intomainfrom
jkarneges/variant-alias
Apr 9, 2026
Merged

add variant type aliases, as preparation to migrate away from QVariant#48319
jkarneges merged 1 commit intomainfrom
jkarneges/variant-alias

Conversation

@jkarneges
Copy link
Copy Markdown
Member

@jkarneges jkarneges commented Apr 8, 2026

As part of our ongoing process of migrating away from Qt types, this PR is the first in a series for addressing QVariant.

The plan is to do something similar to what we're doing with the Cow types, by introducing a replacement type, Variant, that behaves exactly the same way as QVariant and is initially a wrapper around it. Later, the implementation can be substituted with something else, likely std::variant. Unlike the Cow types, however, which are being slowly rolled out throughout the project, for Variant the plan will be to roll it out to the whole project in one shot via a type alias. The reason for doing it this way is to avoid deep copy conversions between our Variant and QVariant, which are hard to avoid when the types are distinct and variants are nested within variants.

Steps:

  1. Add Variant* type aliases (this PR). Easy change, nothing using it yet.
  2. Change all mentions of QVariant* in the whole project to Variant*. The actual types would still be QVariant* so this should be completely safe with no worry about behavioral changes.
  3. Replace Variant* type aliases with Variant* classes that wrap QVariant*, forwarding to an inner instance. No change to the call sites.
  4. Eventually, change the implementation of the Variant* classes with something not Qt-based.

@jkarneges jkarneges requested a review from a team April 8, 2026 23:58
@jkarneges jkarneges merged commit b7b0c50 into main Apr 9, 2026
19 checks passed
@jkarneges jkarneges deleted the jkarneges/variant-alias branch April 9, 2026 15:31
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.

2 participants