Skip to content

Commit 7340f6a

Browse files
Samwelinyalldawson
authored andcommittedJan 18, 2020
added refresh action on wms connection items
1 parent 35550ef commit 7340f6a

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
 

‎src/providers/wms/qgswmsdataitemguiproviders.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ void QgsWmsDataItemGuiProvider::populateContextMenu( QgsDataItem *item, QMenu *m
4343
{
4444
if ( QgsWMSConnectionItem *connItem = qobject_cast< QgsWMSConnectionItem * >( item ) )
4545
{
46+
QAction *actionRefresh = new QAction( tr( "Refresh" ), this );
47+
connect( actionRefresh, &QAction::triggered, this, [connItem] { refreshConnection( connItem ); } );
48+
menu->addAction( actionRefresh );
49+
50+
menu->addSeparator();
51+
4652
QAction *actionEdit = new QAction( tr( "Edit…" ), this );
4753
connect( actionEdit, &QAction::triggered, this, [connItem] { editConnection( connItem ); } );
4854
menu->addAction( actionEdit );
@@ -97,6 +103,14 @@ void QgsWmsDataItemGuiProvider::newConnection( QgsDataItem *item )
97103
}
98104
}
99105

106+
void QgsWmsDataItemGuiProvider::refreshConnection( QgsDataItem *item )
107+
{
108+
item->refresh();
109+
// the parent should be updated
110+
if ( item->parent() )
111+
item->parent()->refreshConnections();
112+
}
113+
100114

101115
// -----------
102116

‎src/providers/wms/qgswmsdataitemguiproviders.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class QgsWmsDataItemGuiProvider : public QObject, public QgsDataItemGuiProvider
3131
QWidget *createParamWidget( QgsDataItem *root, QgsDataItemGuiContext ) override;
3232

3333
private:
34+
static void refreshConnection( QgsDataItem *item );
3435
static void editConnection( QgsDataItem *item );
3536
static void deleteConnection( QgsDataItem *item );
3637
static void newConnection( QgsDataItem *item );

0 commit comments

Comments
 (0)
Please sign in to comment.