Skip to content

Instantly share code, notes, and snippets.

@NathanW2
Created May 21, 2012 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NathanW2/2764906 to your computer and use it in GitHub Desktop.
Save NathanW2/2764906 to your computer and use it in GitHub Desktop.
QSettings
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 3253a34..b202b46 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -315,6 +315,7 @@ int main( int argc, char *argv[] )
}
else if ( i + 1 < argc && ( arg == "--optionspath" || arg == "-o" ) )
{
+ QSettings::setDefaultFormat( QSettings::IniFormat );
QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, argv[++i] );
}
else if ( i + 1 < argc && ( arg == "--configpath" || arg == "-c" ) )
@@ -417,6 +418,7 @@ int main( int argc, char *argv[] )
break;
case 'o':
+ QSettings::setDefaultFormat( QSettings::IniFormat );
QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, optarg );
break;
@@ -479,6 +481,7 @@ int main( int argc, char *argv[] )
if ( !configpath.isEmpty() )
{
// tell QSettings to use INI format and save the file in custom config path
+ QSettings::setDefaultFormat( QSettings::IniFormat );
QSettings::setPath( QSettings::IniFormat, QSettings::UserScope, configpath );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment