QtCollider: fix Q_INVOKABLE SharedImage typename#6970
Merged
elgiano merged 1 commit intosupercollider:3.14from Jun 11, 2025
Merged
QtCollider: fix Q_INVOKABLE SharedImage typename#6970elgiano merged 1 commit intosupercollider:3.14from
elgiano merged 1 commit intosupercollider:3.14from
Conversation
Qt registers SharedImage as a MetaType with its full name (QSharedPointer<QtCollider::Image>), so Q_INVOKABLE methods needs to use the same, otherwise method calls fail with `QMetaMethod::invoke: cannot convert formal parameter 0 from QSharedPointer<> to SharedImage.`
1667af0 to
99ed37d
Compare
capital-G
approved these changes
Jun 11, 2025
Contributor
capital-G
left a comment
There was a problem hiding this comment.
Thanks - wanted to take a look at this today but glad that this has been fixed now :)
Just wanted to know - how did you got the error message QMetaMethod::invoke: cannot convert formal parameter 0 from QSharedPointer<QtCollider::Image> to SharedImage.? This would have helped me a lot during first inspection?
Contributor
Author
|
@capital-G I run |
This was referenced Jun 11, 2025
dyfer
pushed a commit
to dyfer/supercollider
that referenced
this pull request
Jul 16, 2025
Qt registers SharedImage as a MetaType with its full name (QSharedPointer<QtCollider::Image>), so Q_INVOKABLE methods needs to use the same, otherwise method calls fail with `QMetaMethod::invoke: cannot convert formal parameter 0 from QSharedPointer<> to SharedImage.`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose and Motivation
Fixes #6936
We had this problem before with
TreeView, see #6521. This PR applies the same fix.SharedImageis a typedef forQSharedPointer<QtCollider::Image>. Qt registers it as a MetaType with its full nameQSharedPointer<QtCollider::Image>, so Q_INVOKABLE methods needs to use the same name, otherwise method calls fail withQMetaMethod::invoke: cannot convert formal parameter 0 from QSharedPointer<QtCollider::Image> to SharedImage.. Even if the type is the same, Qt gets confused about its name.Here is a note from Qt docs:
For any other use than Q_INVOKABLE,
SharedImageshould be fine, so we can keep thetypedef.I decided to patch also when used with Q_PROPERTY, since Qt mentions it explicitly, even though those methods didn't fail.
You can use this code to test affected Widgets:
Types of changes
To-do list