Skip to content

Conversation

@jnbooth
Copy link
Contributor

@jnbooth jnbooth commented Dec 23, 2025

Adds basic support for QMetaType, which is mainly useful for finding out what's inside a QVariant.

Note: This currently adds a new trait to represent types that have an associated QMetaType::Type:

pub trait QMetaTyped {
    fn meta_type() -> crate::QMetaTypeType;
}

Alternatively, meta_type could become part of the QVariantValue trait, since anything that implements QVariantValue can implement QMetaTyped, and vice versa. If we did that, we could potentially even get rid of all the generated code for QVariantValue::can_convert, and give it a default implementation that does it the way Qt does, like this:

fn can_convert(variant: &QVariant) -> bool {
    variant.can_convert(QMetaType::from_type::<Self>())
}

I think that could be a good idea, but it would be a more significant change, so I went with the conservative approach here to start.

@codecov
Copy link

codecov bot commented Dec 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (c98fb62) to head (73fcfad).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1382   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           75        75           
  Lines        13108     13108           
=========================================
  Hits         13108     13108           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant