Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is editing QML files in QtCreator's graphical editor supported? #293

Open
andrew-otiv opened this issue Aug 16, 2023 · 6 comments
Open

Is editing QML files in QtCreator's graphical editor supported? #293

andrew-otiv opened this issue Aug 16, 2023 · 6 comments
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues.

Comments

@andrew-otiv
Copy link

I would like to be able to edit .qml files using qt's GUI tools. My understanding is that the intended way of using qmetaobject-rs is to always create a custom type from rust, register it with the QML engine, and hook it up to the rest of the GUI using signals, setters, etc...

However, when I try to load any of the qmetaobject-rs example qml files in QtCreator's Design mode, I get errors on the custom types similar to:

image

Do I just need to configure an import path somewhere, or is it currently impossible to use qmetaobject-rs and the gui tools together?

This is a possible duplicate of #242. I'm not sure if that ticket is limited to "Plugins", or if it's the same issue of QtCreator being unaware of any metadata that comes from the rust code.

Thanks!
Andrew

@andrew-otiv
Copy link
Author

As a workaround, is there a way to only expose the actual UI part of the QML to the QtCreator's Design mode? i.e. create a view with all the buttons using the UI, and then use it from another UML file with the types defined in rust?

(I'm still very new to Qt, and I realize learning it from the rust bindings is probably not the normal way)

@ogoffart
Copy link
Member

I think new version of Qt needs a json with the metaobject information which is normally generated by moc, and that we do not generate.
In principle, it should be possible to implement it such that the macro generate this file, although it wouldn't be very clean.

@ratijas
Copy link
Collaborator

ratijas commented Aug 16, 2023

If you write a library and install it somewhere on your qml import path, then it doesn't matter which language its native code was written — qmlplugindump or qmltyperegistrar would be able to find it either way to generate types info json. But if you are registering your types from your main executable, then you are out of luck. This problem in not specific to Rust bindings: if would be the same kind of pain point with C++ app.

That aside, in KDE I never heard of anyone using Qt Creator's GUI tool for editing QML. In my experience, mouse-driven development rarely works well, and you'll end up editing source code text a lot more anyway.

@ratijas ratijas added the C-discussion Category: Discussion or questions that doesn't represent real issues. label Aug 16, 2023
@ogoffart
Copy link
Member

same kind of pain point with C++ app.

I think recent version of qt added the ability for moc to dump a json file, which is found by qtcreator for this kind of things, but i may be wrong.

@ratijas
Copy link
Collaborator

ratijas commented Aug 17, 2023

oh, that sounds cool. Having to run a separate external process after build has always sucked. Recently I found a plugin.qmltypes in our Kirigami repo that hasn't been automatically updates in half a decade! People were randomly adding and removing type declarations from it at first, but even then it was stuck at initial minor version 2.0. Clearly no one cared enough or even knew that it needed some care to be taken for one of the most core QML libraries in our infra.

@andrew-otiv
Copy link
Author

Thanks for the feedbak @ogoffart and @ratijas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues.
Projects
None yet
Development

No branches or pull requests

3 participants