|
78 | 78 | #include "qgslayerstylingwidget.h"
|
79 | 79 | #include "qgstaskmanager.h"
|
80 | 80 | #include "qgsziputils.h"
|
| 81 | +#include "qgsbrowsermodel.h" |
81 | 82 |
|
82 | 83 | #include <QNetworkReply>
|
83 | 84 | #include <QNetworkProxy>
|
@@ -866,23 +867,24 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
|
866 | 867 | }
|
867 | 868 | endProfile();
|
868 | 869 |
|
869 |
| - mBrowserWidget = new QgsBrowserDockWidget( tr( "Browser Panel" ), this ); |
| 870 | + mBrowserModel = new QgsBrowserModel( this ); |
| 871 | + mBrowserWidget = new QgsBrowserDockWidget( tr( "Browser Panel" ), mBrowserModel, this ); |
870 | 872 | mBrowserWidget->setObjectName( QStringLiteral( "Browser" ) );
|
871 | 873 | addDockWidget( Qt::LeftDockWidgetArea, mBrowserWidget );
|
872 | 874 | mBrowserWidget->hide();
|
873 | 875 | connect( this, &QgisApp::newProject, mBrowserWidget, &QgsBrowserDockWidget::updateProjectHome );
|
| 876 | + // Only connect the first widget: the model is shared, there is no need to refresh multiple times. |
874 | 877 | connect( this, &QgisApp::connectionsChanged, mBrowserWidget, &QgsBrowserDockWidget::refresh );
|
875 | 878 | connect( mBrowserWidget, &QgsBrowserDockWidget::connectionsChanged, this, &QgisApp::connectionsChanged );
|
876 | 879 | connect( mBrowserWidget, &QgsBrowserDockWidget::openFile, this, &QgisApp::openFile );
|
877 | 880 | connect( mBrowserWidget, &QgsBrowserDockWidget::handleDropUriList, this, &QgisApp::handleDropUriList );
|
878 | 881 |
|
879 |
| - mBrowserWidget2 = new QgsBrowserDockWidget( tr( "Browser Panel (2)" ), this ); |
| 882 | + mBrowserWidget2 = new QgsBrowserDockWidget( tr( "Browser Panel (2)" ), mBrowserModel, this ); |
880 | 883 | mBrowserWidget2->setObjectName( QStringLiteral( "Browser2" ) );
|
881 | 884 | addDockWidget( Qt::LeftDockWidgetArea, mBrowserWidget2 );
|
882 | 885 | mBrowserWidget2->hide();
|
883 | 886 | connect( this, &QgisApp::newProject, mBrowserWidget2, &QgsBrowserDockWidget::updateProjectHome );
|
884 | 887 | connect( mBrowserWidget2, &QgsBrowserDockWidget::connectionsChanged, this, &QgisApp::connectionsChanged );
|
885 |
| - connect( this, &QgisApp::connectionsChanged, mBrowserWidget2, &QgsBrowserDockWidget::refresh ); |
886 | 888 | connect( mBrowserWidget2, &QgsBrowserDockWidget::openFile, this, &QgisApp::openFile );
|
887 | 889 | connect( mBrowserWidget2, &QgsBrowserDockWidget::handleDropUriList, this, &QgisApp::handleDropUriList );
|
888 | 890 |
|
@@ -1509,9 +1511,8 @@ void QgisApp::dataSourceManager( const QString &pageName )
|
1509 | 1511 | {
|
1510 | 1512 | if ( ! mDataSourceManagerDialog )
|
1511 | 1513 | {
|
1512 |
| - mDataSourceManagerDialog = new QgsDataSourceManagerDialog( this, mapCanvas() ); |
1513 |
| - // Forward signals to this |
1514 |
| - connect( this, &QgisApp::connectionsChanged, mDataSourceManagerDialog, &QgsDataSourceManagerDialog::refresh ); |
| 1514 | + mDataSourceManagerDialog = new QgsDataSourceManagerDialog( mBrowserModel, this, mapCanvas() ); |
| 1515 | + // Forward signals to this. No need to connect refresh: the browser model is shared |
1515 | 1516 | connect( mDataSourceManagerDialog, &QgsDataSourceManagerDialog::connectionsChanged, this, &QgisApp::connectionsChanged );
|
1516 | 1517 | connect( mDataSourceManagerDialog, SIGNAL( addRasterLayer( QString const &, QString const &, QString const & ) ),
|
1517 | 1518 | this, SLOT( addRasterLayer( QString const &, QString const &, QString const & ) ) );
|
|
0 commit comments