KDAB / cxx-qt

Safe interop between Rust and Qt
https://kdab.github.io/cxx-qt/book/
993 stars 66 forks source link

Location of qtquickcontrols2.conf in resources #987

Closed mneilly closed 1 month ago

mneilly commented 1 month ago

Per Supported Environment Variables in Qt Quick Controls, the expected location of qtquickcontrols2.conf is ":/qtquickcontrols2.conf".

If I add qtquickcontrols2.conf to qrc_files it is placed per uri.

Is there a way to force a file to be placed at the root of the application resources? I would like to avoid being required to set QT_QUICK_CONTROLS_CONF to a file system location. It does not appear to accept qrc paths or I could force the env to be set in main.rs before creating the Qt application.

ahayzen-kdab commented 1 month ago

Hey, so the QmlModule::qrc_files is for setting up QML modules similar to qt_add_qml_module, so they end up in qrc:/qt/qml/<uri>.

Instead maybe CxxQtBuilder::qrc might be closer ? As this is similar to qt_add_resources or adding a resource to the executable ? https://docs.rs/cxx-qt-build/latest/cxx_qt_build/struct.CxxQtBuilder.html#method.qrc

Note that this would be similar to this test i was adding here https://github.com/KDAB/cxx-qt/pull/981/files

Otherwise if you are using a CMake build and not a Cargo one you can always add it in the normal way.

Let us know if that works or not !

ahayzen-kdab commented 1 month ago

Also note that the build system being changed which should improve / fix things like Qt resource initialisation which required things like WHOLE_ARCHIVE before. So if qrc doesn't work it might work soon :-)

LeonMatthesKDAB commented 1 month ago

As of #986 Adding qrc files should now be fully supported, which should allow you to place the config at the required location.