QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
qgsprocessingaggregatewidgetwrapper.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprocessingaggregatewidgetwrapper.h
3 ---------------------
4 Date : June 2020
5 Copyright : (C) 2020 by Nyall Dawson
6 Email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSPROCESSINGAGGREGATEWIDGETWRAPPER_H
17#define QGSPROCESSINGAGGREGATEWIDGETWRAPPER_H
18
19#define SIP_NO_FILE
20
23
24#include "ui_qgsprocessingaggregatemappingpanelbase.h"
25
26class QLineEdit;
27class QToolButton;
28
30
31class GUI_EXPORT QgsProcessingAggregatePanelWidget : public QgsPanelWidget, private Ui::QgsProcessingAggregateMapPanelBase
32{
33 Q_OBJECT
34
35 public:
36 QgsProcessingAggregatePanelWidget( QWidget *parent = nullptr );
37
38 void setLayer( QgsVectorLayer *layer );
39 QgsVectorLayer *layer();
40 QVariant value() const;
41 void setValue( const QVariant &value );
42
47 void registerExpressionContextGenerator( const QgsExpressionContextGenerator *generator );
48
49 signals:
50
51 void changed();
52
53 private slots:
54 void loadFieldsFromLayer();
55 void addField();
56 void loadLayerFields();
57
58 private:
59 QgsAggregateMappingModel *mModel = nullptr;
60
61 QgsVectorLayer *mLayer = nullptr;
62 bool mBlockChangedSignal = false;
63};
64
65
66class GUI_EXPORT QgsProcessingAggregateParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
67{
68 Q_OBJECT
69 public:
70 QgsProcessingAggregateParameterDefinitionWidget( QgsProcessingContext &context, const QgsProcessingParameterWidgetContext &widgetContext, const QgsProcessingParameterDefinition *definition = nullptr, const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
71 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
72
73 private:
74 QComboBox *mParentLayerComboBox = nullptr;
75};
76
77
78class GUI_EXPORT QgsProcessingAggregateWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
79{
80 Q_OBJECT
81
82 public:
83 QgsProcessingAggregateWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr, QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
84
85 // QgsProcessingParameterWidgetFactoryInterface
86 QString parameterType() const override;
88
89 // QgsProcessingParameterWidgetWrapper interface
90 QWidget *createWidget() override SIP_FACTORY;
91 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
92 QgsProcessingContext &context,
93 const QgsProcessingParameterWidgetContext &widgetContext,
94 const QgsProcessingParameterDefinition *definition = nullptr,
95 const QgsProcessingAlgorithm *algorithm = nullptr
96 ) override;
97
98 void postInitialize( const QList<QgsAbstractProcessingParameterWidgetWrapper *> &wrappers ) override;
99 int stretch() const override;
100
101 public slots:
102 void setParentLayerWrapperValue( const QgsAbstractProcessingParameterWidgetWrapper *parentWrapper );
103
104 protected:
105 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
106 QVariant widgetValue() const override;
107
108 QStringList compatibleParameterTypes() const override;
109 QStringList compatibleOutputTypes() const override;
110 QString modelerExpressionFormatString() const override;
111 const QgsVectorLayer *linkedVectorLayer() const override;
112
113 private:
114 QgsProcessingAggregatePanelWidget *mPanel = nullptr;
115 std::unique_ptr<QgsVectorLayer> mParentLayer;
116
117 friend class TestProcessingGui;
118};
119
120
122
123#endif // QGSPROCESSINGAGGREGATEWIDGETWRAPPER_H
QFlags< ProcessingParameterFlag > ProcessingParameterFlags
Flags which dictate the behavior of Processing parameters.
Definition qgis.h:3562
A widget wrapper for Processing parameter value widgets.
The QgsAggregateMappingModel holds mapping information for defining sets of aggregates of fields from...
Abstract interface for generating an expression context.
Base class for any widget that can be shown as a inline panel.
Abstract base class for widgets which allow users to specify the properties of a Processing parameter...
Abstract base class for processing algorithms.
Contains information about the context in which a processing algorithm is executed.
WidgetType
Types of dialogs which Processing widgets can be created for.
@ Standard
Standard algorithm dialog.
Base class for the definition of processing parameters.
Contains settings which reflect the context in which a Processing parameter widget is shown,...
An interface for Processing widget wrapper factories.
Represents a vector layer which manages a vector based data sets.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_FACTORY
Definition qgis_sip.h:76