Skip to content
Permalink
Browse files

Expose application browser model instance to iface

Reusing the existing browser model is more efficient then reconstructing
new models, so it's useful for plugins to have access to this instance
too.
  • Loading branch information
nyalldawson committed Oct 16, 2018
1 parent e10736a commit 905031945f3225b7103180560934104f44578ab7
@@ -1142,6 +1142,14 @@ is chosen. Dialog is shown only if global option is set accordingly.
:return: true if a datum transform has been specifically chosen by user or only one is available.

.. versionadded:: 3.0
%End

virtual QgsBrowserModel *browserModel() = 0;
%Docstring
Returns the application browser model. Using this shared model is more efficient than
creating a new browser model for every use.

.. versionadded:: 3.4
%End

signals:
@@ -792,5 +792,10 @@ bool QgisAppInterface::askForDatumTransform( QgsCoordinateReferenceSystem source

void QgisAppInterface::takeAppScreenShots( const QString &saveDirectory, const int categories )
{
return qgis->takeAppScreenShots( saveDirectory, categories );
qgis->takeAppScreenShots( saveDirectory, categories );
}

QgsBrowserModel *QgisAppInterface::browserModel()
{
return qgis->mBrowserModel;
}
@@ -553,6 +553,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface

void takeAppScreenShots( const QString &saveDirectory, const int categories = 0 ) override;

QgsBrowserModel *browserModel() override;

private slots:

@@ -48,6 +48,7 @@ class QgsOptionsWidgetFactory;
class QgsLocatorFilter;
class QgsStatusBar;
class QgsMeshLayer;
class QgsBrowserModel;

#include <QObject>
#include <QFont>
@@ -937,6 +938,13 @@ class GUI_EXPORT QgisInterface : public QObject
*/
virtual bool askForDatumTransform( QgsCoordinateReferenceSystem sourceCrs, QgsCoordinateReferenceSystem destinationCrs ) = 0;

/**
* Returns the application browser model. Using this shared model is more efficient than
* creating a new browser model for every use.
* \since QGIS 3.4
*/
virtual QgsBrowserModel *browserModel() = 0;

signals:

/**

0 comments on commit 9050319

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