Skip to content
Permalink
Browse files

Browser: removed redundant refresh signals

  • Loading branch information
elpaso committed Sep 10, 2017
1 parent 6f0950f commit 22bd2a35f823f630133bfbf4dc57f5e0c7cfa508
@@ -183,9 +183,9 @@ Returns true if the model has been initialized
:rtype: bool
%End

void init();
void initialize();
%Docstring
Delayied initialization
Delayied initialization, needed because the provider registry must be already populated
%End

protected:
@@ -21,10 +21,11 @@ class QgsBrowserDockWidget : QgsDockWidget
%End
public:

explicit QgsBrowserDockWidget( const QString &name, QgsBrowserModel *model, QWidget *parent /TransferThis/ = 0 );
explicit QgsBrowserDockWidget( const QString &name, QgsBrowserModel *browserModel, QWidget *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsBrowserDockWidget
\param name name of the widget
\param browserModel instance of the (shared) browser model
\param parent parent widget
%End
~QgsBrowserDockWidget();
@@ -873,6 +873,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
addDockWidget( Qt::LeftDockWidgetArea, mBrowserWidget );
mBrowserWidget->hide();
connect( this, &QgisApp::newProject, mBrowserWidget, &QgsBrowserDockWidget::updateProjectHome );
// Only connect the first widget: the model is shared, there is no need to refresh multiple times.
connect( this, &QgisApp::connectionsChanged, mBrowserWidget, &QgsBrowserDockWidget::refresh );
connect( mBrowserWidget, &QgsBrowserDockWidget::connectionsChanged, this, &QgisApp::connectionsChanged );
connect( mBrowserWidget, &QgsBrowserDockWidget::openFile, this, &QgisApp::openFile );
@@ -884,7 +885,6 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
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 );

@@ -1512,8 +1512,7 @@ void QgisApp::dataSourceManager( const QString &pageName )
if ( ! mDataSourceManagerDialog )
{
mDataSourceManagerDialog = new QgsDataSourceManagerDialog( mBrowserModel, this, mapCanvas() );
// Forward signals to this
connect( this, &QgisApp::connectionsChanged, mDataSourceManagerDialog, &QgsDataSourceManagerDialog::refresh );
// Forward signals to this. No need to connect refresh: the browser model is shared
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 & ) ) );
@@ -169,7 +169,7 @@ void QgsBrowserModel::removeRootItems()
mRootItems.clear();
}

void QgsBrowserModel::init()
void QgsBrowserModel::initialize()
{
if ( ! mInitialized )
{
@@ -170,8 +170,8 @@ class CORE_EXPORT QgsBrowserModel : public QAbstractItemModel
//! Returns true if the model has been initialized
bool initialized( ) { return mInitialized; }

//! Delayied initialization
void init();
//! Delayied initialization, needed because the provider registry must be already populated
void initialize();

protected:
//! Populates the model
@@ -38,9 +38,9 @@

#include <QDragEnterEvent>

QgsBrowserDockWidget::QgsBrowserDockWidget( const QString &name, QgsBrowserModel *model, QWidget *parent )
QgsBrowserDockWidget::QgsBrowserDockWidget( const QString &name, QgsBrowserModel *browserModel, QWidget *parent )
: QgsDockWidget( parent )
, mModel( model )
, mModel( browserModel )
, mProxyModel( nullptr )
, mPropertiesWidgetEnabled( false )
, mPropertiesWidgetHeight( 0 )
@@ -114,7 +114,7 @@ void QgsBrowserDockWidget::showEvent( QShowEvent *e )
// delayed initialization of the model
if ( !mModel->initialized( ) )
{
mModel->init();
mModel->initialize();
}
if ( ! mProxyModel )
{
@@ -47,9 +47,10 @@ class GUI_EXPORT QgsBrowserDockWidget : public QgsDockWidget, private Ui::QgsBro
/**
* Constructor for QgsBrowserDockWidget
* \param name name of the widget
* \param browserModel instance of the (shared) browser model
* \param parent parent widget
*/
explicit QgsBrowserDockWidget( const QString &name, QgsBrowserModel *model, QWidget *parent SIP_TRANSFERTHIS = nullptr );
explicit QgsBrowserDockWidget( const QString &name, QgsBrowserModel *browserModel, QWidget *parent SIP_TRANSFERTHIS = nullptr );
~QgsBrowserDockWidget();
//! Add directory to favorites
void addFavoriteDirectory( const QString &favDir );
@@ -49,6 +49,7 @@ class GUI_EXPORT QgsDataSourceManagerDialog : public QgsOptionsDialogBase, priva
public:

/** QgsDataSourceManagerDialog constructor
* \param browserModel instance of the (shared) browser model
* \param parent the object
* \param canvas a pointer to the map canvas
* \param fl window flags

0 comments on commit 22bd2a3

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