Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[bugfix] Sync the dialogs connections when changed from the browser
For now it's only for WMS but you get the idea. There is a new abstract base class for the source select dialogs, that will grow with common behavior for all the select dialogs. Signals are forwarded from the (root) data items to the app and then delivered to the various browser instances and to the unified layer dialog. A change in one of the browser items should trigger a refresh in all the other browsers and dialogs.
- Loading branch information
Showing
with
166 additions
and 25 deletions.
- +4 −0 python/core/qgsbrowsermodel.sip
- +9 −0 python/core/qgsdataitem.sip
- +1 −1 python/gui/qgsbrowserdockwidget.sip
- +8 −0 src/core/qgsbrowsermodel.cpp
- +3 −0 src/core/qgsbrowsermodel.h
- +6 −0 src/core/qgsdataitem.cpp
- +5 −0 src/core/qgsdataitem.h
- +3 −0 src/gui/CMakeLists.txt
- +5 −0 src/gui/qgsbrowserdockwidget.cpp
- +1 −1 src/gui/qgsbrowserdockwidget.h
- +3 −3 src/gui/qgsdatasourcemanagerdialog.cpp
- +3 −2 src/gui/qgsdatasourcemanagerdialog.h
- +30 −0 src/gui/qgssourceselect.cpp
- +65 −0 src/gui/qgssourceselect.h
- +3 −9 src/providers/wms/qgswmsdataitems.cpp
- +1 −1 src/providers/wms/qgswmsdataitems.h
- +11 −4 src/providers/wms/qgswmssourceselect.cpp
- +5 −4 src/providers/wms/qgswmssourceselect.h
@@ -0,0 +1,30 @@ | ||
/*************************************************************************** | ||
qgssourceselect.cpp - base class for source selector widgets | ||
------------------- | ||
begin : 10 July 2017 | ||
original : (C) 2017 by Alessandro Pasotti email : apasotti at boundlessgeo dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgssourceselect.h" | ||
|
||
QgsSourceSelect::QgsSourceSelect( QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode ): | ||
QDialog( parent, fl ), | ||
mWidgetMode( widgetMode ) | ||
{ | ||
|
||
} | ||
|
||
QgsSourceSelect::~QgsSourceSelect() | ||
{ | ||
|
||
} |
@@ -0,0 +1,65 @@ | ||
/*************************************************************************** | ||
qgssourceselect.h - base class for source selector widgets | ||
------------------- | ||
begin : 10 July 2017 | ||
original : (C) 2017 by Alessandro Pasotti email : apasotti at boundlessgeo dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSSOURCESELECT_H | ||
#define QGSSOURCESELECT_H | ||
#include "qgis_sip.h" | ||
#include "qgis.h" | ||
#include "qgis_gui.h" | ||
|
||
#include "qgsproviderregistry.h" | ||
#include "qgsguiutils.h" | ||
|
||
#include <QDialog> | ||
|
||
/** \ingroup gui | ||
* \brief Abstract base Dialog to create connections and add layers | ||
* This class must provide common functionality and the interface for all | ||
* source select dialogs used by data providers to configure data sources | ||
* and add layers. | ||
*/ | ||
class GUI_EXPORT QgsSourceSelect : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
|
||
//! Constructor | ||
QgsSourceSelect( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::None ); | ||
|
||
//! Destructor | ||
~QgsSourceSelect( ); | ||
|
||
//! Return the widget mode | ||
QgsProviderRegistry::WidgetMode widgetMode( ) { return mWidgetMode; } | ||
|
||
public slots: | ||
|
||
//! Triggered when the provider's connections need to be refreshed | ||
virtual void refresh( ) = 0; | ||
|
||
signals: | ||
|
||
//! Emitted when the provider's connections have changed | ||
void connectionsChanged(); | ||
|
||
private: | ||
|
||
QgsProviderRegistry::WidgetMode mWidgetMode; | ||
}; | ||
|
||
#endif // QGSSOURCESELECT_H |
Oops, something went wrong.