File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -2462,10 +2462,10 @@ void QgisApp::addLayerDefinition()
2462
2462
if ( path.isEmpty () )
2463
2463
return ;
2464
2464
2465
- QList<QgsMapLayer*> layers = QgsMapLayer::fromLayerDefinitionFile ( path );
2466
- QgsMapLayerRegistry::instance ()->addMapLayers ( layers );
2465
+ openLayerDefinition ( path );
2467
2466
}
2468
2467
2468
+
2469
2469
/* *
2470
2470
This method prompts the user for a list of vector file names with a dialog.
2471
2471
*/
@@ -3806,6 +3806,12 @@ void QgisApp::dxfExport()
3806
3806
}
3807
3807
}
3808
3808
3809
+ void QgisApp::openLayerDefinition ( const QString & path )
3810
+ {
3811
+ QList<QgsMapLayer*> layers = QgsMapLayer::fromLayerDefinitionFile ( path );
3812
+ QgsMapLayerRegistry::instance ()->addMapLayers ( layers );
3813
+ }
3814
+
3809
3815
// Open the project file corresponding to the
3810
3816
// path at the given index in mRecentProjectPaths
3811
3817
void QgisApp::openProject ( QAction *action )
@@ -3914,6 +3920,10 @@ void QgisApp::openFile( const QString & fileName )
3914
3920
QgsDebugMsg ( " Opening project " + fileName );
3915
3921
openProject ( fileName );
3916
3922
}
3923
+ else if ( fi.completeSuffix () == " qlr" )
3924
+ {
3925
+ openLayerDefinition ( fileName );
3926
+ }
3917
3927
else
3918
3928
{
3919
3929
QgsDebugMsg ( " Adding " + fileName + " to the map canvas" );
Original file line number Diff line number Diff line change @@ -164,6 +164,8 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
164
164
Used to process a commandline argument, FileOpen or Drop event.
165
165
*/
166
166
void openProject ( const QString & fileName );
167
+
168
+ void openLayerDefinition ( const QString & filename );
167
169
/* * opens a qgis project file
168
170
@returns false if unable to open the project
169
171
*/
You can’t perform that action at this time.
0 commit comments