Open FuSoftware opened 3 years ago
Seems like the crate doesn't like it when the paths has a dash in it. Curious to know if it's the QML engine itself that has a problem with it, or if it's somewhere else. Even stranger is that it works if the QML source doesn't contain any inline component.
// Doesn't work
engine.load_file("config/DW-8P/DW-8P.qml".into());
// Works
engine.load_file("config/DW8P/DW8P.qml".into())
Can you elaborate, please, what do you mean by this:
the crate has no support for runtime QRC files
Sounds like a Qt bug, but I'll have to verify.
What I mean is that, if I understood correctly, the qrc!
macro is only evalutated at compile time, it cannot be defined at runtime. Not sure if it is a Qt bug, as it works when used with Qt C++. Maybe something with how the crate interfaces with Qt ?
Well, with Qt's native rcc
tool, you have options to either translate you resources it to *.cpp
which would be compiled and baked right into your lib/bin target (which CMake handles out of the box), or to build an equivalent *.rcc
resource container which can be loaded at runtime. So, it takes *.qrc
XML file as an input, and produces either *.cpp
for compile-time or *.rcc
for run-time.
In this crate the rcc.exe
is replaced by qrc!()
procedural macro which runs at compile time by rustc itself, so no external tooling is needed.
I do not rule out the possibility, however, that this crate implementation may be buggy, and struggles with dashes in filenames.
Can you provide "Minimal Complete and Verifiable Example" for both C++ and Rust projects?
Using inline components, on Qt 5.15.2, I regularly stumble on an error :
This popup only shows when building for debug, and only shows up when using Rust. If I compile my code in a QML project in QtCreator, I get no errors at all.
I currently send no property to the QML context, nor expose a custom class to the QML engine.
Looking at the source, it seems it's indeed linked to the inline component.
Is it a known issue, and is there a way to mitigate it ? As the crate has no support for runtime QRC files, I'm having to declare my entire UI in a single file, and make use of inline components.
Example of an inline component :
Thanks in advance