@@ -722,7 +722,11 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
722
722
// update windows
723
723
qApp->processEvents ();
724
724
725
- fileNewBlank (); // prepare empty project
725
+ // check if a project has been loaded already via drag/drop or filesystem loading
726
+ if ( !QgsProject::instance () )
727
+ {
728
+ fileNewBlank (); // prepare empty project
729
+ }
726
730
727
731
} // QgisApp ctor
728
732
@@ -3285,8 +3289,21 @@ void QgisApp::fileOpenAfterLaunch()
3285
3289
{
3286
3290
// TODO: move auto-open project options to enums
3287
3291
3292
+ // check if a project is already loaded via command line or filesystem
3293
+ if ( !QgsProject::instance ()->fileName ().isNull () )
3294
+ {
3295
+ return ;
3296
+ }
3297
+
3298
+ // check if a data source is already loaded via command line or filesystem
3299
+ // empty project with layer loaded, but may not trigger a dirty project at this point
3300
+ if ( QgsProject::instance () && QgsMapLayerRegistry::instance ()->count () > 0 )
3301
+ {
3302
+ return ;
3303
+ }
3304
+
3288
3305
// fileNewBlank() has already been called in QgisApp constructor
3289
- // loaded project is either a new blank one, or one from command line
3306
+ // loaded project is either a new blank one, or one from command line/filesystem
3290
3307
QSettings settings;
3291
3308
QString autoOpenMsgTitle = tr ( " Auto-open Project" );
3292
3309
@@ -3326,12 +3343,6 @@ void QgisApp::fileOpenAfterLaunch()
3326
3343
return ;
3327
3344
}
3328
3345
3329
- // check if a project is already loaded via command line
3330
- if ( !QgsProject::instance ()->fileName ().isNull () )
3331
- {
3332
- return ;
3333
- }
3334
-
3335
3346
if ( projOpen == 0 ) // new project (default)
3336
3347
{
3337
3348
// open default template, if defined
0 commit comments