QtCore Settings does not support ini files located in resources
Unsolved
QML and Qt Quick
-
Hi,
Qt.labs.settings (Qt5.15) supports read/write from/to files located in resources.
After upgrading to Qt6.2, my legacy code still works.
After upgrading to Qt6.5.1/Qt6.5.2, my application crashes in QQmlApplicationEngine::load function.
QtCore Settings seems to have the same behavior.I wrote an application sample to show you:
import QtQuick import QtQuick.Controls import QtQuick.Window import QtCore // for Settings (Qt >= 6.5) // import Qt.labs.settings 1.0 // for Settings (Qt < 6.5) Window { width: 640 height: 480 visible: true Rectangle { width: 100 height: 100 color: "red" border.color: "black" border.width: 5 radius: 10 Label { id: label anchors.centerIn: parent text: "TBD" Settings { category: "test" location: ":/test_settings.ini" // NOK (Qt == 6.5) // location: encodeURIComponent(":test_settings.ini") // NOK (Qt == 6.5) // location: "qrc://test_settings.ini" // NOK (Qt == 6.5) // no location // OK (Qt == 6.5) // fileName: ":/test_settings.ini" // OK (Qt < 6.5) property alias text: label.text } } } }
# ini file in resources [test] text=from resource
# ini file in local storage [test] text=from local
In this example, the application displays the wrong text. In Qt6.5, it always read from local storage. Never from resources.
Thank you for your answer in advance!
-
@Richard-Buchmann I guess I put this issue in the wrong place. I send a bug report there : https://bugreports.qt.io/browse/QTBUG-116681