Ini Files
-
@jsulm I have some custom made ini files which I read from with QSettings. Nothing special, just some key, value pairs with string and boolean values. The ini files are registered in qrc. Is that the key factor as to why this might get built into my application, hence no need to have those ini files present anymore in the deployment folder?
@Redman
If you have embedded the file as a resource in the executable then there is no external file.Beware! Such resource files can only be opened read-only, not for update, since they are embedded, A while ago I believe someone found this did not work with
QSettingsini files, as, for right or for wrong,QSettingsinsists on opening for update, because settings can be altered. And I thought they reported this then failed on an embedded ini file. Have you verified yourQSettingsworks opening such a file? -
Hello,
What exactly happens to the ini files I use during development?
When I install my application with cmake the resulting folder does not contain any of the ini files but the values are read correctly -
@Redman Please explain better. What ini files? How do you use them? How do you install the ini files?
@jsulm I have some custom made ini files which I read from with QSettings. Nothing special, just some key, value pairs with string and boolean values. The ini files are registered in qrc. Is that the key factor as to why this might get built into my application, hence no need to have those ini files present anymore in the deployment folder?
-
@jsulm I have some custom made ini files which I read from with QSettings. Nothing special, just some key, value pairs with string and boolean values. The ini files are registered in qrc. Is that the key factor as to why this might get built into my application, hence no need to have those ini files present anymore in the deployment folder?
@Redman
If you have embedded the file as a resource in the executable then there is no external file.Beware! Such resource files can only be opened read-only, not for update, since they are embedded, A while ago I believe someone found this did not work with
QSettingsini files, as, for right or for wrong,QSettingsinsists on opening for update, because settings can be altered. And I thought they reported this then failed on an embedded ini file. Have you verified yourQSettingsworks opening such a file? -
@Redman
If you have embedded the file as a resource in the executable then there is no external file.Beware! Such resource files can only be opened read-only, not for update, since they are embedded, A while ago I believe someone found this did not work with
QSettingsini files, as, for right or for wrong,QSettingsinsists on opening for update, because settings can be altered. And I thought they reported this then failed on an embedded ini file. Have you verified yourQSettingsworks opening such a file? -
@jsulm I have some custom made ini files which I read from with QSettings. Nothing special, just some key, value pairs with string and boolean values. The ini files are registered in qrc. Is that the key factor as to why this might get built into my application, hence no need to have those ini files present anymore in the deployment folder?
@Redman Files in recourse files are built into the executable. That also means that you can not change them at runtime. To do so you need to copy the ini files into a proper location if they are not yet present there and read/modify them there. To find proper config location use: https://doc.qt.io/qt-6/qstandardpaths.html#standardLocations with QStandardPaths::AppConfigLocation
-
You can also provide default values for your settings. In that case you don't even have to include any ini files into qrc in the first place. Provide a path where ini files can be written instead.
-
R Redman has marked this topic as solved on