Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a QgsDataItemGuiProvider interface and registry for providers
These providers will be used to control how the browser data items behave within GUI, and to allow separation of GUI related properties of browser items from the core code. A new registry QgsDataItemGuiProviderRegistry has been created (modeled off QgsDataItemProviderRegistry), with an application wide instance available from QgsGui::instance()->dataItemGuiProviderRegistry()
- Loading branch information
1 parent
0b17db6
commit 6ec7f02
Showing
16 changed files
with
404 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/qgsdataitemguiprovider.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
class QgsDataItemGuiProvider | ||
{ | ||
%Docstring | ||
|
||
Abstract base class for providers which affect how QgsDataItem items behave | ||
within the application GUI. | ||
|
||
Providers must be registered via QgsDataItemGuiProviderRegistry. | ||
|
||
.. versionadded:: 3.6 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsdataitemguiprovider.h" | ||
%End | ||
public: | ||
|
||
virtual ~QgsDataItemGuiProvider(); | ||
|
||
virtual QString name() = 0; | ||
%Docstring | ||
Returns the provider's name. | ||
%End | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/qgsdataitemguiprovider.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
61 changes: 61 additions & 0 deletions
61
python/gui/auto_generated/qgsdataitemguiproviderregistry.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/qgsdataitemguiproviderregistry.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
class QgsDataItemGuiProviderRegistry | ||
{ | ||
%Docstring | ||
This class keeps a list of data item GUI providers that may affect how QgsDataItems | ||
behave within the application GUI. | ||
|
||
QgsDataItemGuiProviderRegistry is not usually directly created, but rather accessed through | ||
QgsGui.instance()->dataItemGuiProviderRegistry(). | ||
|
||
.. versionadded:: 3.6 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsdataitemguiproviderregistry.h" | ||
%End | ||
public: | ||
|
||
QgsDataItemGuiProviderRegistry(); | ||
|
||
~QgsDataItemGuiProviderRegistry(); | ||
|
||
|
||
QList<QgsDataItemGuiProvider *> providers() const; | ||
%Docstring | ||
Returns the list of available providers. | ||
%End | ||
|
||
void addProvider( QgsDataItemGuiProvider *provider /Transfer/ ); | ||
%Docstring | ||
Adds a ``provider`` implementation to the registry. Ownership of the provider | ||
is transferred to the registry. | ||
%End | ||
|
||
void removeProvider( QgsDataItemGuiProvider *provider ); | ||
%Docstring | ||
Removes a ``provider`` implementation from the registry. | ||
The provider object is automatically deleted. | ||
%End | ||
|
||
private: | ||
QgsDataItemGuiProviderRegistry( const QgsDataItemGuiProviderRegistry &rh ); | ||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/qgsdataitemguiproviderregistry.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/*************************************************************************** | ||
qgsdataitemguiprovider.cpp | ||
-------------------------------------- | ||
Date : October 2018 | ||
Copyright : (C) 2018 by Nyall Dawson | ||
Email : nyall dot dawson at gmail 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 "qgsdataitemguiprovider.h" | ||
|
||
// no implementation currently |
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,47 @@ | ||
/*************************************************************************** | ||
qgsdataitemguiprovider.h | ||
-------------------------------------- | ||
Date : October 2018 | ||
Copyright : (C) 2018 by Nyall Dawson | ||
Email : nyall dot dawson at gmail 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 QGSDATAITEMGUIPROVIDER_H | ||
#define QGSDATAITEMGUIPROVIDER_H | ||
|
||
#include "qgis_gui.h" | ||
|
||
class QString; | ||
|
||
/** | ||
* \class QgsDataItemGuiProvider | ||
* \ingroup gui | ||
* | ||
* Abstract base class for providers which affect how QgsDataItem items behave | ||
* within the application GUI. | ||
* | ||
* Providers must be registered via QgsDataItemGuiProviderRegistry. | ||
* | ||
* \since QGIS 3.6 | ||
*/ | ||
class GUI_EXPORT QgsDataItemGuiProvider | ||
{ | ||
public: | ||
|
||
virtual ~QgsDataItemGuiProvider() = default; | ||
|
||
/** | ||
* Returns the provider's name. | ||
*/ | ||
virtual QString name() = 0; | ||
|
||
}; | ||
|
||
#endif // QGSDATAITEMGUIPROVIDER_H |
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,38 @@ | ||
/*************************************************************************** | ||
qgsdataitemguiproviderregistry.cpp | ||
-------------------------------------- | ||
Date : October 2018 | ||
Copyright : (C) 2018 by Nyall Dawson | ||
Email : nyall dot dawson at gmail 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 "qgsdataitemguiproviderregistry.h" | ||
#include "qgsdataitemguiprovider.h" | ||
|
||
QgsDataItemGuiProviderRegistry::QgsDataItemGuiProviderRegistry() | ||
{ | ||
} | ||
|
||
QgsDataItemGuiProviderRegistry::~QgsDataItemGuiProviderRegistry() | ||
{ | ||
qDeleteAll( mProviders ); | ||
} | ||
|
||
void QgsDataItemGuiProviderRegistry::addProvider( QgsDataItemGuiProvider *provider ) | ||
{ | ||
mProviders.append( provider ); | ||
} | ||
|
||
void QgsDataItemGuiProviderRegistry::removeProvider( QgsDataItemGuiProvider *provider ) | ||
{ | ||
int index = mProviders.indexOf( provider ); | ||
if ( index >= 0 ) | ||
delete mProviders.takeAt( index ); | ||
} |
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,76 @@ | ||
/*************************************************************************** | ||
qgsdataitemguiproviderregistry.h | ||
-------------------------------------- | ||
Date : October 2018 | ||
Copyright : (C) 2018 by Nyall Dawson | ||
Email : nyall dot dawson at gmail 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 QGSDATAITEMGUIPROVIDERREGISTRY_H | ||
#define QGSDATAITEMGUIPROVIDERREGISTRY_H | ||
|
||
#include "qgis_gui.h" | ||
#include "qgis_sip.h" | ||
#include <QList> | ||
|
||
class QgsDataItemGuiProvider; | ||
|
||
/** | ||
* \class QgsDataItemGuiProviderRegistry | ||
* \ingroup gui | ||
* This class keeps a list of data item GUI providers that may affect how QgsDataItems | ||
* behave within the application GUI. | ||
* | ||
* QgsDataItemGuiProviderRegistry is not usually directly created, but rather accessed through | ||
* QgsGui::instance()->dataItemGuiProviderRegistry(). | ||
* | ||
* \since QGIS 3.6 | ||
*/ | ||
class GUI_EXPORT QgsDataItemGuiProviderRegistry | ||
{ | ||
public: | ||
|
||
QgsDataItemGuiProviderRegistry(); | ||
|
||
~QgsDataItemGuiProviderRegistry(); | ||
|
||
//! QgsDataItemGuiProviderRegistry cannot be copied. | ||
QgsDataItemGuiProviderRegistry( const QgsDataItemGuiProviderRegistry &rh ) = delete; | ||
//! QgsDataItemGuiProviderRegistry cannot be copied. | ||
QgsDataItemGuiProviderRegistry &operator=( const QgsDataItemGuiProviderRegistry &rh ) = delete; | ||
|
||
/** | ||
* Returns the list of available providers. | ||
*/ | ||
QList<QgsDataItemGuiProvider *> providers() const { return mProviders; } | ||
|
||
/** | ||
* Adds a \a provider implementation to the registry. Ownership of the provider | ||
* is transferred to the registry. | ||
*/ | ||
void addProvider( QgsDataItemGuiProvider *provider SIP_TRANSFER ); | ||
|
||
/** | ||
* Removes a \a provider implementation from the registry. | ||
* The provider object is automatically deleted. | ||
*/ | ||
void removeProvider( QgsDataItemGuiProvider *provider ); | ||
|
||
private: | ||
#ifdef SIP_RUN | ||
QgsDataItemGuiProviderRegistry( const QgsDataItemGuiProviderRegistry &rh ); | ||
#endif | ||
|
||
//! Available providers, owned by this class | ||
QList<QgsDataItemGuiProvider *> mProviders; | ||
|
||
}; | ||
|
||
#endif // QGSDATAITEMGUIPROVIDERREGISTRY_H |
Oops, something went wrong.