@@ -115,6 +115,7 @@ void usage( std::string const & appName )
115
115
<< " \t [--optionspath path]\t use the given QSettings path\n "
116
116
<< " \t [--configpath path]\t use the given path for all user configuration\n "
117
117
<< " \t [--code path]\t run the given python file on load\n "
118
+ << " \t [--defaultui]\t start by resetting user ui settings to default\n "
118
119
<< " \t [--help]\t\t this text\n\n "
119
120
<< " FILE:\n "
120
121
<< " Files specified on the command line can include rasters,\n "
@@ -453,6 +454,7 @@ int main( int argc, char *argv[] )
453
454
myHideSplash = true ;
454
455
#endif
455
456
457
+ bool myRestoreDefaultWindowState = false ;
456
458
bool myRestorePlugins = true ;
457
459
bool myCustomization = true ;
458
460
@@ -554,6 +556,10 @@ int main( int argc, char *argv[] )
554
556
{
555
557
customizationfile = QDir::convertSeparators ( QFileInfo ( args[++i] ).absoluteFilePath () );
556
558
}
559
+ else if ( arg == " --defaultui" || arg == " -d" )
560
+ {
561
+ myRestoreDefaultWindowState = true ;
562
+ }
557
563
else
558
564
{
559
565
myFileList.append ( QDir::convertSeparators ( QFileInfo ( args[i] ).absoluteFilePath () ) );
@@ -858,6 +864,15 @@ int main( int argc, char *argv[] )
858
864
mypSplash->show ();
859
865
}
860
866
867
+ // optionally restore default window state
868
+ // use restoreDefaultWindowState setting only if NOT using command line (then it is set already)
869
+ if ( myRestoreDefaultWindowState || mySettings.value ( " /qgis/restoreDefaultWindowState" , false ).toBool () )
870
+ {
871
+ QgsDebugMsg ( " Resetting /UI/state settings!" );
872
+ mySettings.remove ( " /UI/state" );
873
+ mySettings.remove ( " /qgis/restoreDefaultWindowState" );
874
+ }
875
+
861
876
QgisApp *qgis = new QgisApp ( mypSplash, myRestorePlugins ); // "QgisApp" used to find canonical instance
862
877
qgis->setObjectName ( " QgisApp" );
863
878
0 commit comments