Skip to content

Commit ea28c2d

Browse files
authoredSep 15, 2017
Merge pull request #5194 from boundlessgeo/iface_conn_changed
Adds connectionsChanged signal to iface
2 parents c5ae3a0 + a13aa96 commit ea28c2d

File tree

6 files changed

+45
-2
lines changed

6 files changed

+45
-2
lines changed
 

‎python/gui/qgisinterface.sip

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,15 @@ Add a project
155155
virtual void newProject( bool promptToSaveFlag = false ) = 0;
156156
%Docstring
157157
Start a blank project
158+
%End
159+
160+
virtual void reloadConnections( ) = 0;
161+
%Docstring
162+
Triggered when connections have changed.
163+
This calls reloadConnections in the main application and triggers a signal that is
164+
forwarded to the GUI elements that needs to be updated (i.e. the source
165+
select dialogs and the browser widgets)
166+
.. versionadded:: 3.0
158167
%End
159168

160169
virtual QgsMapLayer *activeLayer() = 0;
@@ -1256,6 +1265,7 @@ Get timeout for timed messages: default of 5 seconds
12561265
\note
12571266
added in version 2.7
12581267
%End
1268+
12591269
};
12601270

12611271
/************************************************************************

‎src/app/qgisapp.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
933933

934934
mInternalClipboard = new QgsClipboard; // create clipboard
935935
connect( mInternalClipboard, &QgsClipboard::changed, this, &QgisApp::clipboardChanged );
936-
mQgisInterface = new QgisAppInterface( this ); // create the interfce
936+
mQgisInterface = new QgisAppInterface( this ); // create the interface
937937

938938
#ifdef Q_OS_MAC
939939
// action for Window menu (create before generating WindowTitleChange event))
@@ -9666,6 +9666,11 @@ bool QgisApp::setActiveLayer( QgsMapLayer *layer )
96669666
return true;
96679667
}
96689668

9669+
void QgisApp::reloadConnections()
9670+
{
9671+
emit( connectionsChanged( ) );
9672+
}
9673+
96699674

96709675
QgsVectorLayer *QgisApp::addVectorLayer( const QString &vectorLayerPath, const QString &baseName, const QString &providerKey )
96719676
{

‎src/app/qgisapp.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
792792

793793

794794
/**
795-
* \brief dataSourceManager Open the DataSourceManager dialog/dock
795+
* \brief dataSourceManager Open the DataSourceManager dialog
796796
* \param pageName the page name, usually the provider name or "browser" (for the browser panel)
797797
* or "ogr" (vector layers) or "raster" (raster layers)
798798
*/
@@ -858,6 +858,11 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
858858
//! set the active layer
859859
bool setActiveLayer( QgsMapLayer * );
860860

861+
/** Reload connections emitting the connectionsChanged signal
862+
* \since QGIS 3.0
863+
*/
864+
void reloadConnections();
865+
861866
protected:
862867

863868
//! Handle state changes (WindowTitleChange)

‎src/app/qgisappinterface.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ void QgisAppInterface::newProject( bool promptToSaveFlag )
171171
qgis->fileNew( promptToSaveFlag );
172172
}
173173

174+
void QgisAppInterface::reloadConnections()
175+
{
176+
qgis->reloadConnections( );
177+
}
178+
174179
QgsMapLayer *QgisAppInterface::activeLayer()
175180
{
176181
return qgis->activeLayer();

‎src/app/qgisappinterface.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
8181
//! Start a new blank project
8282
void newProject( bool promptToSaveFlag = false ) override;
8383

84+
/**
85+
* Triggered by plugins when connections have changed.
86+
* This is forwarded to the GUI elements that needs to be updated (i.e. the source
87+
* select dialogs and the browser widgets)
88+
* \since QGIS 3.0
89+
*/
90+
void reloadConnections( ) override;
91+
8492
//! Get pointer to the active layer (layer selected in the legend)
8593
QgsMapLayer *activeLayer() override;
8694

‎src/gui/qgisinterface.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,15 @@ class GUI_EXPORT QgisInterface : public QObject
165165
//! Start a blank project
166166
virtual void newProject( bool promptToSaveFlag = false ) = 0;
167167

168+
/**
169+
* Triggered when connections have changed.
170+
* This calls reloadConnections in the main application and triggers a signal that is
171+
* forwarded to the GUI elements that needs to be updated (i.e. the source
172+
* select dialogs and the browser widgets)
173+
* \since QGIS 3.0
174+
*/
175+
virtual void reloadConnections( ) = 0;
176+
168177
//! Get pointer to the active layer (layer selected in the legend)
169178
virtual QgsMapLayer *activeLayer() = 0;
170179

@@ -796,6 +805,7 @@ class GUI_EXPORT QgisInterface : public QObject
796805
* added in version 2.7
797806
*/
798807
void layerSavedAs( QgsMapLayer *l, const QString &path );
808+
799809
};
800810
Q_NOWARN_DEPRECATED_POP
801811

0 commit comments

Comments
 (0)
Please sign in to comment.