Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add API to allow creation of widgets for customising a layer's source
This adds api in the provider gui to allow a provider to create a custom widget which exposes options to customise and change the layer's source. E.g. a file based layer provider could expose a widget for selecting a new file path, and an online one could expose widgets for changing the host, authentication, etc.
- Loading branch information
1 parent
0dc0ca5
commit d5c3b4b
Showing
22 changed files
with
785 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/qgsprovidersourcewidget.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
class QgsProviderSourceWidget : QWidget | ||
{ | ||
%Docstring | ||
Base class for widgets which allow customisation of a provider's source URI. | ||
|
||
.. versionadded:: 3.18 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsprovidersourcewidget.h" | ||
%End | ||
public: | ||
|
||
QgsProviderSourceWidget( QWidget *parent /TransferThis/ = 0 ); | ||
%Docstring | ||
Constructor for QgsProviderSourceWidget with the specified ``parent`` widget. | ||
%End | ||
|
||
virtual void setSourceUri( const QString &uri ) = 0; | ||
%Docstring | ||
Sets the source ``uri`` to show in the widget. | ||
|
||
.. seealso:: :py:func:`sourceUri` | ||
%End | ||
|
||
virtual QString sourceUri() const = 0; | ||
%Docstring | ||
Returns the source URI as currently defined by the widget. | ||
|
||
.. seealso:: :py:func:`setSourceUri` | ||
%End | ||
|
||
}; | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/qgsprovidersourcewidget.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
61 changes: 61 additions & 0 deletions
61
python/gui/auto_generated/qgsprovidersourcewidgetprovider.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/qgsprovidersourcewidgetprovider.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
class QgsProviderSourceWidgetProvider | ||
{ | ||
%Docstring | ||
|
||
An interface for providers of widgets designed to configure a data provider's source. | ||
|
||
.. versionadded:: 3.18 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsprovidersourcewidgetprovider.h" | ||
%End | ||
public: | ||
|
||
virtual ~QgsProviderSourceWidgetProvider(); | ||
|
||
virtual QString providerKey() const = 0; | ||
%Docstring | ||
Provider key | ||
%End | ||
|
||
virtual QString name() const; | ||
%Docstring | ||
Source widget provider name, this is useful to retrieve | ||
a particular source widget provider in case the provider has more | ||
than one, it should be unique among all providers. | ||
|
||
The default implementation returns the :py:func:`~QgsProviderSourceWidgetProvider.providerKey` | ||
%End | ||
|
||
virtual bool canHandleLayer( QgsMapLayer *layer ) const = 0; | ||
%Docstring | ||
Returns ``True`` if the provider can handle the specified ``layer``. | ||
%End | ||
|
||
virtual QgsProviderSourceWidget *createWidget( QgsMapLayer *layer, QWidget *parent /TransferThis/ = 0 ) = 0 /Factory/; | ||
%Docstring | ||
Creates a new widget to configure the source of the specified ``layer``. | ||
It may return ``None`` if it cannot handle the layer. | ||
The returned object must be destroyed by the caller. | ||
%End | ||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/qgsprovidersourcewidgetprovider.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
83 changes: 83 additions & 0 deletions
83
python/gui/auto_generated/qgsprovidersourcewidgetproviderregistry.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/qgsprovidersourcewidgetproviderregistry.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
|
||
class QgsProviderSourceWidgetProviderRegistry | ||
{ | ||
%Docstring | ||
This class keeps a list of provider source widget providers. | ||
|
||
QgsProviderSourceWidgetProviderRegistry is not usually directly created, but rather accessed through | ||
QgsGui.QgsProviderSourceWidgetProviderRegistry(). | ||
|
||
.. versionadded:: 3.18 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsprovidersourcewidgetproviderregistry.h" | ||
%End | ||
public: | ||
|
||
QgsProviderSourceWidgetProviderRegistry(); | ||
~QgsProviderSourceWidgetProviderRegistry(); | ||
|
||
|
||
QList< QgsProviderSourceWidgetProvider *> providers(); | ||
%Docstring | ||
Gets list of available providers | ||
%End | ||
|
||
void addProvider( QgsProviderSourceWidgetProvider *provider /Transfer/ ); | ||
%Docstring | ||
Add a ``provider`` implementation. Takes ownership of the object. | ||
%End | ||
|
||
bool removeProvider( QgsProviderSourceWidgetProvider *provider /Transfer/ ); | ||
%Docstring | ||
Remove ``provider`` implementation from the list (``provider`` object is deleted) | ||
|
||
:return: ``True`` if the provider was actually removed and deleted | ||
%End | ||
|
||
void initializeFromProviderGuiRegistry( QgsProviderGuiRegistry *providerGuiRegistry ); | ||
%Docstring | ||
Initializes the registry. The registry needs to be passed explicitly | ||
(instead of using singleton) because this gets called from QgsGui constructor. | ||
%End | ||
|
||
QgsProviderSourceWidgetProvider *providerByName( const QString &name ); | ||
%Docstring | ||
Returns a provider by ``name`` or ``None`` if not found | ||
%End | ||
|
||
QList<QgsProviderSourceWidgetProvider *> providersByKey( const QString &providerKey ); | ||
%Docstring | ||
Returns a (possibly empty) list of providers by data ``providerkey`` | ||
%End | ||
|
||
QgsProviderSourceWidget *createWidget( QgsMapLayer *layer, QWidget *parent /TransferThis/ = 0 ) /TransferBack/; | ||
%Docstring | ||
Creates a new widget to configure the source of the specified ``layer``. | ||
It may return ``None`` if no provider was found. | ||
The returned object must be destroyed by the caller. | ||
%End | ||
|
||
private: | ||
QgsProviderSourceWidgetProviderRegistry( const QgsProviderSourceWidgetProviderRegistry &rh ); | ||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/qgsprovidersourcewidgetproviderregistry.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.