Skip to content
Permalink
Browse files

fix string and fix connection signal/slot: followup 11531c6

  • Loading branch information
slarosa committed Mar 19, 2018
1 parent 11531c6 commit ee5dc8da21c5c654ae358ceb614b32bf96b3273a
Showing with 25 additions and 13 deletions.
  1. +1 −1 src/app/qgisapp.cpp
  2. +4 −6 src/app/qgisapp.h
  3. +20 −6 src/app/qgsapplayertreeviewmenuprovider.cpp
@@ -6995,7 +6995,7 @@ void QgisApp::saveStyleFile( QgsMapLayer *layer )
QgsSettings settings;
QString lastUsedDir = settings.value( QStringLiteral( "style/lastStyleDir" ), QDir::homePath() ).toString();
QString filename = QFileDialog::getSaveFileName( this,
tr( "Save layer properties as style file" ),
tr( "Save as QGIS Layer Style File" ),
lastUsedDir,
tr( "QGIS Layer Style File" ) + " (*.qml)" );
if ( filename.isEmpty() )
@@ -695,7 +695,10 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
void saveAsFile( QgsMapLayer *layer = nullptr );
//! save qml style for the current layer
void saveStyleFile( QgsMapLayer *layer = nullptr );

//! save qrl definition for the current layer
void saveAsLayerDefinition();
//! save current raster layer
void saveAsRasterFile( QgsRasterLayer *layer = nullptr );
//! Process the list of URIs that have been dropped in QGIS
void handleDropUriList( const QgsMimeDataUtils::UriList &lst );
//! Convenience function to open either a project or a layer file.
@@ -1505,11 +1508,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
//! set the CAD dock widget visible
void setCadDockVisible( bool visible );

void saveAsLayerDefinition();

//! save current raster layer
void saveAsRasterFile( QgsRasterLayer *layer = nullptr );

//! show Python console
void showPythonDialog();

@@ -253,18 +253,32 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()

// save as vector file
QMenu *menuExportVector = new QMenu( tr( "Export" ), menu );
menuExportVector->addAction( tr( "Save as…" ), QgisApp::instance(), SLOT( saveAsFile() ) );
menuExportVector->addAction( tr( "Save as Layer Definition File…" ), QgisApp::instance(), SLOT( saveAsLayerDefinition() ) );
QAction *actionSaveAs = new QAction( tr( "Save as…" ), menuExportVector );
QAction *actionSaveAsDefinitionLayer = new QAction( tr( "Save as Layer Definition File…" ), menuExportVector );
connect( actionSaveAs, &QAction::triggered, QgisApp::instance(), [ = ] { QgisApp::instance()->saveAsFile(); } );
menuExportVector->addAction( actionSaveAs );
connect( actionSaveAsDefinitionLayer, &QAction::triggered, QgisApp::instance(), &QgisApp::saveAsLayerDefinition );
menuExportVector->addAction( actionSaveAsDefinitionLayer );
if ( vlayer->isSpatial() )
menuExportVector->addAction( tr( "QGIS Layer Style File…" ), QgisApp::instance(), SLOT( saveStyleFile() ) );
{
QAction *actionSaveStyle = new QAction( tr( "Save as QGIS Layer Style File…" ), menuExportVector );
connect( actionSaveStyle, &QAction::triggered, QgisApp::instance(), [ = ] { QgisApp::instance()->saveStyleFile(); } );
menuExportVector->addAction( actionSaveStyle );
}
menu->addMenu( menuExportVector );
}
else if ( rlayer )
{
QMenu *menuExportRaster = new QMenu( tr( "Export" ), menu );
menuExportRaster->addAction( tr( "Save As…" ), QgisApp::instance(), SLOT( saveAsRasterFile() ) );
menuExportRaster->addAction( tr( "Save As Layer Definition File…" ), QgisApp::instance(), SLOT( saveAsLayerDefinition() ) );
menuExportRaster->addAction( tr( "QGIS Layer Style File…" ), QgisApp::instance(), SLOT( saveStyleFile() ) );
QAction *actionSaveAs = new QAction( tr( "Save as…" ), menuExportRaster );
QAction *actionSaveAsDefinitionLayer = new QAction( tr( "Save as Layer Definition File…" ), menuExportRaster );
QAction *actionSaveStyle = new QAction( tr( "Save as QGIS Layer Style File…" ), menuExportRaster );
connect( actionSaveAs, &QAction::triggered, QgisApp::instance(), [ = ] { QgisApp::instance()->saveAsFile(); } );
menuExportRaster->addAction( actionSaveAs );
connect( actionSaveAsDefinitionLayer, &QAction::triggered, QgisApp::instance(), &QgisApp::saveAsLayerDefinition );
menuExportRaster->addAction( actionSaveAsDefinitionLayer );
connect( actionSaveStyle, &QAction::triggered, QgisApp::instance(), [ = ] { QgisApp::instance()->saveStyleFile(); } );
menuExportRaster->addAction( actionSaveStyle );
menu->addMenu( menuExportRaster );

menu->addSeparator();

0 comments on commit ee5dc8d

Please sign in to comment.
You can’t perform that action at this time.