QtCS25 - Using Qt Quick with other programming languages
Session Summary
Presentation by Vladimir and Discussion
Session Owners
Vladmir Minenko
Fabian Kosmale
Notes
Roadmap see Vladimir's slides.
- .Net, Java, Rust, Swift, Python covered
- What to do about JavaScript? Needs more research
- People ask about Go
- Maybe network-based transport between Qt Quick and other language? REST, OpenAPI?
How does it actually work?? Can we have an example?
Python as example:
- Bridge exports a single funtion
- Function accepts a Python container
- Makes it available in QML, via reflection, as a singleton (or QAbstractItemModel? or some property?)
- Idea:
- Provide small library
- Use native types from respective language
- Do language-dependent magic to transform data for QML
- Rust: procedural macros
- Python, Java, Swift: reflection
- C#: don't know yet (currently generating C++ code)
- expose limited subset of data to QML
How does this interact with tooling/qmlcachegen etc?
- We can't do all the type registration at run time (but how else? and what is build time even?)
- Compilation to C++ is probably not a good idea
- Optimized byte code compilation might work
What about other QML modules? Can they be used? For example QtMultimedia
- Can use everything exposed to QML
- Custom rendering probably not
What is the use case?
- Qt-owned UI with different host language
- For Python piggy-back on Qt for Python
- For Rust piggy-back to CXX-Qt
- No combining with other frameworks for now
- Embedding is a different project, for example see android
What types will be available?
- Some primitive types: string, url, numbers, etc
- No custom QQuickItem for now (that would be full bindings)
- Maybe simple QObject-derived types
- We hope that only exposing data (value types) is enough
What IDE will be used? Qt Creator or the language-specific one?
- We don't know yet
- We want to support language-native IDEs
- We need to generalize our QML tooling (not only qmlls, but also profiler or debugger)
Does data need to be copied when moving between other language and QML?
- Depends on host language
- Python has dictionaries; hopefully we can use them to back JavaScript objects in QML
Would you be able to mix e.g. Qt for Python with the python bridget?
- With python and rust, probably
- Not with swift because we don't have full bindings
- With probably yes, using QtJambi
Need to expand QML API of QtQuick to prevent the urge to use C++ API
Can you use multiple different bridges in one app?
- Nobody brought this up yet. We don't know yet.
- What about moving data from one backend language to another via QML?
What about performance?
Presentation Slides
