[SOLVED] using the prefix in a resource file
-
If you want to load an image from a certain location, use QDir::homePath(), QUrl or whatever is required (QFileDialog, QDesktopServices). If you need an image in your resource file, use the resource editor to add it and let Qt handle it. You don't need access to the home dir then.
-
In that case, you should look into the QDesktopServices class. It will supply you with a cross platform way to query for locations on disk like this. In your case, you are probably looking for QDesktopServices::DataLocation.
Note that inside your Qt program, you should use forward slashes for all file paths, even on Windows. Only for paths you display to the user, you can use QDir::toNativeSeparators to get the native format.
-
Franzk: i cant use QSettings cause i need to save the configurations to a file so i could load it again using the QFile then use QSettings.
Andre: i think ill try QDesktopServices::DataLocation. it seems that this directory is where my configurations files to be stored.
-
[quote author="xeroblast" date="1299583686"]Franzk: i cant use QSettings cause i need to save the configurations to a file so i could load it again using the QFile then use QSettings.[/quote]
QSettings can do ini files. You just have to explicitly tell it to do that on windows. On linux the settings are stored in ~/.config/.
-
[quote author="Franzk" date="1299585456"]QSettings can do ini files. You just have to explicitly tell it to do that on windows. On linux the settings are stored in ~/.config/.[/quote]
ok. i think this is what i want. i just didnt know where the ini files located. i thought QSettings didnt saved it.
so in windows, where is the ini files located?
-
It saves them where you tell it to save them. By default it will go for registry, but there's the option of setting the format and file: http://doc.trolltech.com/latest/qsettings.html#QSettings-4
-
Resolved mine also. thanks again.
Can there be a small an example put in the list also. Would help lot as most of us spend loads of time searching it.