int main(int argc, char *argv[])
{
// This is a windows only application, so I hardcoded saving to %APPDATA%/MyApp/settings.ini
QString appDataPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
QString projectAppDataDir = QDir::cleanPath(appDataPath + "/" + APPLICATION_NAME);
QString iniFilePath = QDir::cleanPath(projectAppDataDir + "/" + "settings.ini");
// Prepare folder for the settings
{
QDir createDir{appDataPath};
if(!createDir.mkpath(APPLICATION_NAME)) {
qDebug()
Подробнее здесь: [url]https://stackoverflow.com/questions/79083103/should-i-pass-qsettings-to-main-window-as-a-refference-or-is-it-safe-to-copy[/url]
Я не уверен, существует ли какая-то магия умных указателей для настроек. Вот как я их использую сейчас: [code] int main(int argc, char *argv[]) {
// This is a windows only application, so I hardcoded saving to %APPDATA%/MyApp/settings.ini QString appDataPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); QString projectAppDataDir = QDir::cleanPath(appDataPath + "/" + APPLICATION_NAME); QString iniFilePath = QDir::cleanPath(projectAppDataDir + "/" + "settings.ini"); // Prepare folder for the settings { QDir createDir{appDataPath};