Skip to content

Commit

Permalink
Fix of writing/reading QSettings
Browse files Browse the repository at this point in the history
Wrong order of initialization
  • Loading branch information
vsklencar committed Feb 19, 2021
1 parent 8a3b003 commit bc9b8e9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 0 additions & 4 deletions app/appsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
AppSettings::AppSettings( QObject *parent ): QObject( parent )
{
QSettings settings;
settings.setDefaultFormat( QSettings::NativeFormat );
settings.beginGroup( mGroupName );

QString path = settings.value( "defaultProject", "" ).toString();
QString layer = settings.value( "defaultLayer/" + path, "" ).toString();
bool autoCenter = settings.value( "autoCenter", false ).toBool();
Expand Down Expand Up @@ -170,7 +168,6 @@ void AppSettings::setReuseLastEnteredValues( bool reuseLastEnteredValues )
void AppSettings::setValue( const QString &key, const QVariant &value )
{
QSettings settings;
settings.setDefaultFormat( QSettings::NativeFormat );
settings.beginGroup( mGroupName );
settings.setValue( key, value );
settings.endGroup();
Expand All @@ -179,7 +176,6 @@ void AppSettings::setValue( const QString &key, const QVariant &value )
QVariant AppSettings::value( const QString &key, const QVariant &defaultValue )
{
QSettings settings;
settings.setDefaultFormat( QSettings::NativeFormat );
settings.beginGroup( mGroupName );
QVariant value = settings.value( key, defaultValue );
settings.endGroup();
Expand Down
7 changes: 3 additions & 4 deletions app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,18 +339,17 @@ int main( int argc, char *argv[] )
appBundleDir = QCoreApplication::applicationDirPath() + "\\qgis-data";
//TODO win32 package demo projects
#endif

AppSettings as;
InputProjUtils inputProjUtils;
inputProjUtils.initProjLib( appBundleDir, dataDir, projectDir );
init_qgis( appBundleDir );

AppSettings as;
// copy demo projects when the app is launched for the first time
if ( !as.demoProjectsCopied() )
{
copy_demo_projects( demoDir, projectDir );
as.setDemoProjectsCopied( true );
}
inputProjUtils.initProjLib( appBundleDir, dataDir, projectDir );
init_qgis( appBundleDir );

// Create Input classes
AndroidUtils au;
Expand Down

2 comments on commit bc9b8e9

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

signed apk: armeabi-v7a (SDK: android-20)

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

signed apk: arm64-v8a (SDK: android-20)

Please sign in to comment.