Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[processing] Initial work on porting base GUI classes to c++
- Add abstract base class for Processing widget wrappers to c++ - Add wrapper factory interface to c++ - Make QgsProcessingGuiRegistry also register widget wrapper factories, and be responsible for creation of new c++ processing widget wrapper instances - Start on private c++ implementation of boolean widget wrapper, including unit tests
- Loading branch information
1 parent
bb91170
commit 644ef6a
Showing
21 changed files
with
1,293 additions
and
189 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
194 changes: 194 additions & 0 deletions
194
python/gui/auto_generated/processing/qgsprocessingwidgetwrapper.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,194 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/processing/qgsprocessingwidgetwrapper.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
|
||
|
||
class QgsAbstractProcessingParameterWidgetWrapper : QObject | ||
{ | ||
%Docstring | ||
|
||
A widget wrapper for Processing parameter value widgets. | ||
|
||
Widget wrappers are used to create widgets for individual Processing parameters, and | ||
handle retrieving and setting the current value for those parameters. | ||
|
||
Widget wrappers can be created for different dialog types, allowing different | ||
appearance and behavior of widgets depending on whether they are being created for | ||
use in a standard algorithm dialog, a batch processing dialog, or a modeler dialog. | ||
|
||
Individual widget wrappers are not usually created directly, instead they are | ||
constructed through the central registry, via calls to | ||
QgsGui.processingGuiRegistry()->createParameterWidgetWrapper(). | ||
|
||
.. versionadded:: 3.4 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsprocessingwidgetwrapper.h" | ||
%End | ||
public: | ||
|
||
enum WidgetType | ||
{ | ||
Standard, | ||
Batch, | ||
Modeler, | ||
}; | ||
|
||
QgsAbstractProcessingParameterWidgetWrapper( const QgsProcessingParameterDefinition *parameter = 0, | ||
WidgetType type = Standard, QObject *parent /TransferThis/ = 0 ); | ||
%Docstring | ||
Constructor for QgsAbstractProcessingParameterWidgetWrapper, for the specified | ||
``parameter`` definition and dialog ``type``. | ||
%End | ||
|
||
WidgetType type() const; | ||
%Docstring | ||
Returns the dialog type for which widgets and labels will be created by this wrapper. | ||
%End | ||
|
||
QWidget *createWrappedWidget( const QgsProcessingContext &context ) /Factory/; | ||
%Docstring | ||
Creates and return a new wrapped widget which allows customization of the parameter's value. | ||
|
||
The caller takes ownership of the returned widget. The wrapped widget can be retrieved at a later | ||
stage by calling wrappedWidget(). | ||
|
||
The supplied ``context`` is used while initializing the widget to the parameter's default value. | ||
|
||
.. seealso:: :py:func:`createWrappedLabel` | ||
%End | ||
|
||
QLabel *createWrappedLabel() /Factory/; | ||
%Docstring | ||
Creates and returns a new label to accompany widgets created by the wrapper. | ||
|
||
The caller takes ownership of the returned label. Some parameter type and dialog type | ||
combinations will return None for this method. If None is returned, then no | ||
label should be shown for the parameter's widget (i.e. the label is embedded inside the | ||
widget itself). | ||
|
||
The wrapped label can be retrieved at a later stage by calling wrappedLabel(). | ||
|
||
.. seealso:: :py:func:`createWrappedWidget` | ||
%End | ||
|
||
QWidget *wrappedWidget(); | ||
%Docstring | ||
Returns the current wrapped widget, if any. | ||
|
||
.. seealso:: :py:func:`createWrappedWidget` | ||
%End | ||
|
||
QLabel *wrappedLabel(); | ||
%Docstring | ||
Returns the current wrapped label, if any. | ||
|
||
.. seealso:: :py:func:`createWrappedLabel` | ||
%End | ||
|
||
const QgsProcessingParameterDefinition *parameterDefinition() const; | ||
%Docstring | ||
Returns the parameter definition associated with this wrapper. | ||
%End | ||
|
||
virtual void setWidgetValue( const QVariant &value, const QgsProcessingContext &context ) = 0; | ||
%Docstring | ||
Sets the current ``value`` for the parameter. | ||
|
||
The ``context`` argument is used to specify the wider Processing context which the | ||
current value is associated with. | ||
|
||
.. seealso:: :py:func:`value` | ||
%End | ||
|
||
virtual QVariant value() const = 0; | ||
%Docstring | ||
Returns the current value of the parameter. | ||
|
||
.. seealso:: :py:func:`setWidgetValue` | ||
%End | ||
|
||
virtual void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ); | ||
%Docstring | ||
Called after all wrappers have been created within a particular dialog or context, | ||
allowing the wrapper to connect to the wrappers of other, related parameters. | ||
%End | ||
|
||
protected: | ||
|
||
virtual QWidget *createWidget() = 0 /Factory/; | ||
%Docstring | ||
Creates a new widget which allows customization of the parameter's value. | ||
|
||
The caller takes ownership of the returned widget. | ||
|
||
.. seealso:: :py:func:`createLabel` | ||
%End | ||
|
||
virtual QLabel *createLabel() /Factory/; | ||
%Docstring | ||
Creates a new label to accompany widgets created by the wrapper. | ||
|
||
The caller takes ownership of the returned label. Some parameter type and dialog type | ||
combinations will return None for this method. If None is returned, then no | ||
label should be shown for the parameter's widget (i.e. the label is embedded inside the | ||
widget itself). | ||
|
||
.. seealso:: :py:func:`createWidget` | ||
%End | ||
|
||
}; | ||
|
||
|
||
class QgsProcessingParameterWidgetFactoryInterface | ||
{ | ||
%Docstring | ||
|
||
An interface for Processing widget wrapper factories. | ||
|
||
Widget wrapper factories allow creation of QgsAbstractProcessingParameterWidgetWrapper objects. | ||
They are centrally managed by :py:class:`QgsProcessingGuiRegistry`. Usually, individual factories | ||
are not directly utilized, rather the QgsGui.processingGuiRegistry()->createParameterWidgetWrapper() | ||
method is used to create widget wrappers. | ||
|
||
.. versionadded:: 3.4 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsprocessingwidgetwrapper.h" | ||
%End | ||
public: | ||
|
||
virtual ~QgsProcessingParameterWidgetFactoryInterface(); | ||
|
||
virtual QString parameterType() const = 0; | ||
%Docstring | ||
Returns the type string for the parameter type the factory is associated with. | ||
%End | ||
|
||
virtual QgsAbstractProcessingParameterWidgetWrapper *createWidgetWrapper( const QgsProcessingParameterDefinition *parameter, | ||
QgsAbstractProcessingParameterWidgetWrapper::WidgetType type ) = 0 /Factory/; | ||
%Docstring | ||
Creates a new widget wrapper for the specified ``parameter`` definition. | ||
|
||
The ``type`` argument indicates the dialog type to create a wrapper for. | ||
%End | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/processing/qgsprocessingwidgetwrapper.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.