Skip to content
Permalink
Browse files

[addlayerbutton] Connect and forward all signals from browser to app

  • Loading branch information
elpaso committed Jun 2, 2017
1 parent c188911 commit 7a2ce49408bb534def90f7f6730f71fb254dd594
Showing with 17 additions and 4 deletions.
  1. +4 −0 src/app/qgisapp.cpp
  2. +2 −4 src/app/qgisapp.h
  3. +4 −0 src/app/qgsdatasourcemanagerdialog.cpp
  4. +7 −0 src/app/qgsdatasourcemanagerdialog.h
@@ -1604,6 +1604,10 @@ void QgisApp::dataSourceManager( QString pageName )
connect( mDataSourceManagerDialog, &QgsDataSourceManagerDialog::addDatabaseLayers, this, &QgisApp::addDatabaseLayers );
connect( mDataSourceManagerDialog, &QgsDataSourceManagerDialog::replaceSelectedVectorLayer, this, &QgisApp::replaceSelectedVectorLayer );
connect( mDataSourceManagerDialog, static_cast<void ( QgsDataSourceManagerDialog::* )()>( &QgsDataSourceManagerDialog::addRasterLayer ), this, static_cast<void ( QgisApp::* )()>( &QgisApp::addRasterLayer ) );
connect( mDataSourceManagerDialog, &QgsDataSourceManagerDialog::handleDropUriList, this, &QgisApp::handleDropUriList );
connect( this, &QgisApp::newProject, mDataSourceManagerDialog, &QgsDataSourceManagerDialog::updateProjectHome );
connect( mDataSourceManagerDialog, &QgsDataSourceManagerDialog::openFile, this, &QgisApp::openFile );

}
// Try to open the dialog on a particular page
if ( ! pageName.isEmpty( ) )
@@ -594,14 +594,12 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
//! Unregister a previously registered custom drop handler.
void unregisterCustomDropHandler( QgsCustomDropHandler *handler );

public slots:
//! Process the list of URIs that have been dropped in QGIS
void handleDropUriList( const QgsMimeDataUtils::UriList &lst );

//! Returns the active map layer.
QgsMapLayer *activeLayer();

public slots:
//! 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.
void openFile( const QString &fileName );
void layerTreeViewDoubleClicked( const QModelIndex &index );
@@ -48,6 +48,10 @@ QgsDataSourceManagerDialog::QgsDataSourceManagerDialog( QgsMapCanvas *mapCanvas,
mBrowserWidget->setFeatures( QDockWidget::NoDockWidgetFeatures );
ui->mOptionsStackedWidget->addWidget( mBrowserWidget );
mPageNames.append( QStringLiteral( "browser" ) );
// Forward all browser signals
connect( mBrowserWidget, &QgsBrowserDockWidget::handleDropUriList, this, &QgsDataSourceManagerDialog::handleDropUriList );
connect( mBrowserWidget, &QgsBrowserDockWidget::openFile, this, &QgsDataSourceManagerDialog::openFile );
connect( this, &QgsDataSourceManagerDialog::updateProjectHome, mBrowserWidget, &QgsBrowserDockWidget::updateProjectHome );

// VECTOR Layers (completely different interface: it's not a provider)
QgsOpenVectorLayerDialog *ovl = new QgsOpenVectorLayerDialog( this, Qt::Widget, QgsProviderRegistry::WidgetMode::Embedded );
@@ -21,6 +21,7 @@
#include <QDialog>
#include "qgsoptionsdialogbase.h"
#include "qgsguiutils.h"
#include "qgsmimedatautils.h"
#include "qgshelp.h"

class QgsBrowserDockWidget;
@@ -72,6 +73,12 @@ class QgsDataSourceManagerDialog : public QgsOptionsDialogBase
void showProgress( int progress, int totalSteps );
void showStatusMessage( const QString &message );
void addDatabaseLayers( QStringList const &layerPathList, QString const &providerKey );
//! Emitted when a file needs to be opened
void openFile( const QString & );
//! Emitted when drop uri list needs to be handled from the browser
void handleDropUriList( const QgsMimeDataUtils::UriList & );
//! Update project home directory
void updateProjectHome();

private:
//! Return the dialog from the provider

0 comments on commit 7a2ce49

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