Closed andrew-otiv closed 4 weeks ago
Thanks for taking the time to ask this question.
Not sure if anyone has attempted to use CXX-Qt with QtSafeRenderer yet.
Generally CXX-Qt itself generates what Qt thinks is normal C++ code, so if you define a QObject in Rust it'll work like a normal QObject from a Qt perspective.
From the perspective of using C++ types in Rust we provide some types already wrapped in cxx-qt-lib
, but it is also possible for developers to wrap types themselves using CXX or other tools like autocxx etc. Furthermore with the next version of CXX-Qt ( 0.6 ) it will be much easier to declare your own bindings to existing Qt Objects as we are introducing extern "C++Qt"
and extern "RustQt"
as blocks to complement the extern "C++"
and extern "Rust"
CXX blocks.
Whether that is enough to use safe renderer types would need investigating.
Looking at the QtSafe API most of it are just plain C++ classes or structs, no QObject or signals / slots. So for these you could use CXX and/or autocxx to create bindings to/from.
Note that CXX-Qt is now a superset of CXX so you can mix CXX blocks within the CXX-Qt bridges. Then if anything did use signals or QObject the extern "C++Qt" block we now have could be used in CXX-Qt.
For the QML side we are building to normal QML modules so if they can be used then it should also work.
So it should be possible to create a crate like cxx-qt-lib which has bindings for the C++ classes if that is desired or they could be contributed to cxx-qt-lib-extras if there is use in having them already wrapped. Therefore i'll close this issue as it should be possible with the current ecosystem to use Qt Safe Renderer, please open a new issue if this does not work.
Has anyone attempted to use CXX-Qt with QtSafeRenderer? I'm curous how much, if any, of the QtSafeRenderer API already has bindings. There are no hits when searching the codebase for "QtSafe*", so I'm guess there is no support yet, but maybe someone has some code off in another branch or in a fork.