mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
[bugfix] Sync the bowser connections when changed from the select dialogs
For now, the sync works only in one direction: from the dialogs to the browser instances
This commit is contained in:
parent
7ec8c4ae3b
commit
9ff73c0b77
@ -120,6 +120,10 @@ Emitted when a file needs to be opened
|
||||
void handleDropUriList( const QgsMimeDataUtils::UriList & );
|
||||
%Docstring
|
||||
Emitted when drop uri list needs to be handled
|
||||
%End
|
||||
void connectionsChanged( );
|
||||
%Docstring
|
||||
Connections changed in the browser
|
||||
%End
|
||||
|
||||
protected:
|
||||
|
@ -888,6 +888,8 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
|
||||
addDockWidget( Qt::LeftDockWidgetArea, mBrowserWidget );
|
||||
mBrowserWidget->hide();
|
||||
connect( this, &QgisApp::newProject, mBrowserWidget, &QgsBrowserDockWidget::updateProjectHome );
|
||||
connect( this, &QgisApp::connectionsChanged, mBrowserWidget, &QgsBrowserDockWidget::refresh );
|
||||
connect( mBrowserWidget, &QgsBrowserDockWidget::connectionsChanged, this, &QgisApp::connectionsChanged );
|
||||
connect( mBrowserWidget, &QgsBrowserDockWidget::openFile, this, &QgisApp::openFile );
|
||||
connect( mBrowserWidget, &QgsBrowserDockWidget::handleDropUriList, this, &QgisApp::handleDropUriList );
|
||||
|
||||
@ -896,6 +898,8 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
|
||||
addDockWidget( Qt::LeftDockWidgetArea, mBrowserWidget2 );
|
||||
mBrowserWidget2->hide();
|
||||
connect( this, &QgisApp::newProject, mBrowserWidget2, &QgsBrowserDockWidget::updateProjectHome );
|
||||
connect( mBrowserWidget2, &QgsBrowserDockWidget::connectionsChanged, this, &QgisApp::connectionsChanged );
|
||||
connect( this, &QgisApp::connectionsChanged, mBrowserWidget2, &QgsBrowserDockWidget::refresh );
|
||||
connect( mBrowserWidget2, &QgsBrowserDockWidget::openFile, this, &QgisApp::openFile );
|
||||
connect( mBrowserWidget2, &QgsBrowserDockWidget::handleDropUriList, this, &QgisApp::handleDropUriList );
|
||||
|
||||
@ -1594,6 +1598,8 @@ void QgisApp::dataSourceManager( QString pageName )
|
||||
{
|
||||
mDataSourceManagerDialog = new QgsDataSourceManagerDialog( mapCanvas( ), this );
|
||||
// Forward signals to this
|
||||
connect( this, &QgisApp::connectionsChanged, mDataSourceManagerDialog, &QgsDataSourceManagerDialog::refresh );
|
||||
connect( mDataSourceManagerDialog, &QgsDataSourceManagerDialog::connectionsChanged, this, &QgisApp::connectionsChanged );
|
||||
connect( mDataSourceManagerDialog, SIGNAL( addRasterLayer( QString const &, QString const &, QString const & ) ),
|
||||
this, SLOT( addRasterLayer( QString const &, QString const &, QString const & ) ) );
|
||||
connect( mDataSourceManagerDialog, SIGNAL( addVectorLayer( QString const &, QString const &, QString const & ) ),
|
||||
|
@ -1494,6 +1494,12 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
|
||||
|
||||
signals:
|
||||
|
||||
/**
|
||||
* Emitted when a connection has been added/removed or changed by the provider
|
||||
* selection dialogs
|
||||
*/
|
||||
void connectionsChanged( );
|
||||
|
||||
/** Emitted when a key is pressed and we want non widget sublasses to be able
|
||||
to pick up on this (e.g. maplayer) */
|
||||
void keyPressed( QKeyEvent *e );
|
||||
|
@ -117,7 +117,7 @@ void QgsBrowserDockWidget::showEvent( QShowEvent *e )
|
||||
mModel = new QgsBrowserModel( mBrowserView );
|
||||
mProxyModel = new QgsBrowserTreeFilterProxyModel( this );
|
||||
mProxyModel->setBrowserModel( mModel );
|
||||
mBrowserView->setSettingsSection( objectName().toLower() ); // to distinguish 2 instances ow browser
|
||||
mBrowserView->setSettingsSection( objectName().toLower() ); // to distinguish 2 or more instances of the browser
|
||||
mBrowserView->setBrowserModel( mModel );
|
||||
mBrowserView->setModel( mProxyModel );
|
||||
// provide a horizontal scroll bar instead of using ellipse (...) for longer items
|
||||
@ -242,7 +242,8 @@ void QgsBrowserDockWidget::removeFavorite()
|
||||
|
||||
void QgsBrowserDockWidget::refresh()
|
||||
{
|
||||
refreshModel( QModelIndex() );
|
||||
if ( mModel )
|
||||
refreshModel( QModelIndex() );
|
||||
}
|
||||
|
||||
void QgsBrowserDockWidget::refreshModel( const QModelIndex &index )
|
||||
|
@ -102,6 +102,8 @@ class GUI_EXPORT QgsBrowserDockWidget : public QgsDockWidget, private Ui::QgsBro
|
||||
void openFile( const QString & );
|
||||
//! Emitted when drop uri list needs to be handled
|
||||
void handleDropUriList( const QgsMimeDataUtils::UriList & );
|
||||
//! Connections changed in the browser
|
||||
void connectionsChanged( );
|
||||
|
||||
protected:
|
||||
//! Show event override
|
||||
|
@ -51,6 +51,7 @@ QgsDataSourceManagerDialog::QgsDataSourceManagerDialog( QgsMapCanvas *mapCanvas,
|
||||
// Forward all browser signals
|
||||
connect( mBrowserWidget, &QgsBrowserDockWidget::handleDropUriList, this, &QgsDataSourceManagerDialog::handleDropUriList );
|
||||
connect( mBrowserWidget, &QgsBrowserDockWidget::openFile, this, &QgsDataSourceManagerDialog::openFile );
|
||||
connect( mBrowserWidget, &QgsBrowserDockWidget::connectionsChanged, this, &QgsDataSourceManagerDialog::connectionsChanged );
|
||||
connect( this, &QgsDataSourceManagerDialog::updateProjectHome, mBrowserWidget, &QgsBrowserDockWidget::updateProjectHome );
|
||||
|
||||
// VECTOR Layers (completely different interface: it's not a provider)
|
||||
@ -115,6 +116,7 @@ QgsDataSourceManagerDialog::QgsDataSourceManagerDialog( QgsMapCanvas *mapCanvas,
|
||||
{
|
||||
this->vectorLayerAdded( vectorLayerPath, baseName, QStringLiteral( "WFS" ) );
|
||||
} );
|
||||
connect( dlg, SIGNAL( connectionsChanged( ) ), this, SIGNAL( connectionsChanged( ) ) );
|
||||
}
|
||||
|
||||
addRasterProviderDialog( QStringLiteral( "arcgismapserver" ), tr( "ArcGIS Map Server" ), QStringLiteral( "/mActionAddAmsLayer.svg" ) );
|
||||
@ -166,6 +168,12 @@ void QgsDataSourceManagerDialog::setPreviousPage()
|
||||
setCurrentPage( prevPage );
|
||||
}
|
||||
|
||||
void QgsDataSourceManagerDialog::refresh()
|
||||
{
|
||||
mBrowserWidget->refresh( );
|
||||
emit dlg_refresh();
|
||||
}
|
||||
|
||||
void QgsDataSourceManagerDialog::rasterLayerAdded( const QString &uri, const QString &baseName, const QString &providerKey )
|
||||
{
|
||||
emit addRasterLayer( uri, baseName, providerKey );
|
||||
@ -212,6 +220,8 @@ void QgsDataSourceManagerDialog::addDbProviderDialog( const QString providerKey,
|
||||
this, SIGNAL( showProgress( int, int ) ) );
|
||||
connect( dlg, SIGNAL( progressMessage( QString ) ),
|
||||
this, SIGNAL( showStatusMessage( QString ) ) );
|
||||
connect( dlg, SIGNAL( connectionsChanged( ) ), this, SIGNAL( connectionsChanged( ) ) );
|
||||
connect( this, SIGNAL( dlg_refresh( ) ), dlg, SLOT( refresh( ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,5 +233,7 @@ void QgsDataSourceManagerDialog::addRasterProviderDialog( const QString provider
|
||||
// Forward
|
||||
connect( dlg, SIGNAL( addRasterLayer( QString const &, QString const &, QString const & ) ),
|
||||
this, SIGNAL( addRasterLayer( QString const &, QString const &, QString const & ) ) );
|
||||
connect( dlg, SIGNAL( connectionsChanged( ) ), this, SIGNAL( connectionsChanged( ) ) );
|
||||
connect( this, SIGNAL( dlg_refresh( ) ), dlg, SLOT( refresh( ) ) );
|
||||
}
|
||||
}
|
||||
|
@ -74,6 +74,8 @@ class GUI_EXPORT QgsDataSourceManagerDialog : public QgsOptionsDialogBase, priva
|
||||
void vectorLayersAdded( const QStringList &layerQStringList, const QString &enc, const QString &dataSourceType );
|
||||
//! Reset current page to previously selected page
|
||||
void setPreviousPage();
|
||||
//! Refresh the browser view
|
||||
void refresh( );
|
||||
|
||||
signals:
|
||||
//! Emitted when a raster layer was selected for addition: for signal forwarding to QgisApp
|
||||
@ -102,6 +104,10 @@ class GUI_EXPORT QgsDataSourceManagerDialog : public QgsOptionsDialogBase, priva
|
||||
void handleDropUriList( const QgsMimeDataUtils::UriList & );
|
||||
//! Update project home directory
|
||||
void updateProjectHome();
|
||||
//! Connections changed
|
||||
void connectionsChanged( );
|
||||
// internal signal
|
||||
void dlg_refresh( );
|
||||
|
||||
private:
|
||||
//! Return the dialog from the provider
|
||||
@ -114,6 +120,7 @@ class GUI_EXPORT QgsDataSourceManagerDialog : public QgsOptionsDialogBase, priva
|
||||
QgsMapCanvas *mMapCanvas = nullptr;
|
||||
int mPreviousRow;
|
||||
QStringList mPageNames;
|
||||
|
||||
};
|
||||
|
||||
#endif // QGSDATASOURCEMANAGERDIALOG_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user