QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgsprocessingwidgetwrapperimpl.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsprocessingwidgetwrapperimpl.h
3  ---------------------
4  begin : August 2018
5  copyright : (C) 2018 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 
19 #ifndef QGSPROCESSINGWIDGETWRAPPERIMPL_H
20 #define QGSPROCESSINGWIDGETWRAPPERIMPL_H
21 
22 #define SIP_NO_FILE
25 #include "qgsmaptool.h"
26 #include "qgsprocessingcontext.h"
27 #include "processing/models/qgsprocessingmodelchildparametersource.h"
28 
29 #include <QAbstractButton>
30 
31 class QCheckBox;
32 class QComboBox;
33 class QLineEdit;
34 class QPlainTextEdit;
35 class QToolButton;
36 class QButtonGroup;
38 class QgsSpinBox;
39 class QgsDoubleSpinBox;
41 class QgsProcessingMatrixParameterPanel;
42 class QgsFileWidget;
47 class QgsLayoutComboBox;
49 class QgsPrintLayout;
50 class QgsScaleWidget;
51 class QgsSnapIndicator;
52 class QgsFilterLineEdit;
53 class QgsColorButton;
55 class QgsFieldComboBox;
56 class QgsDateTimeEdit;
57 class QgsDateEdit;
58 class QgsTimeEdit;
62 class QgsExtentWidget;
63 class QgsProcessingEnumModelerWidget;
64 class QgsProcessingMatrixModelerWidget;
65 class QgsProcessingMapLayerComboBox;
67 class QgsProcessingLayerOutputDestinationWidget;
69 
71 
72 class GUI_EXPORT QgsProcessingBooleanParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
73 {
74  Q_OBJECT
75  public:
76 
77  QgsProcessingBooleanParameterDefinitionWidget( QgsProcessingContext &context,
78  const QgsProcessingParameterWidgetContext &widgetContext,
79  const QgsProcessingParameterDefinition *definition = nullptr,
80  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
81  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
82 
83  private:
84 
85  QCheckBox *mDefaultCheckBox = nullptr;
86 
87 };
88 
89 class GUI_EXPORT QgsProcessingBooleanWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
90 {
91  Q_OBJECT
92 
93  public:
94 
95  QgsProcessingBooleanWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
96  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
97 
98  // QgsProcessingParameterWidgetFactoryInterface
99  QString parameterType() const override;
101  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
102  QgsProcessingContext &context,
103  const QgsProcessingParameterWidgetContext &widgetContext,
104  const QgsProcessingParameterDefinition *definition = nullptr,
105  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
106 
107  // QgsProcessingParameterWidgetWrapper interface
108  QWidget *createWidget() override SIP_FACTORY;
109  QLabel *createLabel() override SIP_FACTORY;
110 
111  protected:
112 
113  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
114  QVariant widgetValue() const override;
115 
116  QStringList compatibleParameterTypes() const override;
117 
118  QStringList compatibleOutputTypes() const override;
119 
120  private:
121 
122  QCheckBox *mCheckBox = nullptr;
123  QComboBox *mComboBox = nullptr;
124 
125  friend class TestProcessingGui;
126 };
127 
128 
129 
130 class GUI_EXPORT QgsProcessingCrsParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
131 {
132  Q_OBJECT
133  public:
134 
135  QgsProcessingCrsParameterDefinitionWidget( QgsProcessingContext &context,
136  const QgsProcessingParameterWidgetContext &widgetContext,
137  const QgsProcessingParameterDefinition *definition = nullptr,
138  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
139  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
140 
141  private:
142 
143  QgsProjectionSelectionWidget *mCrsSelector = nullptr;
144 };
145 
146 class GUI_EXPORT QgsProcessingCrsWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
147 {
148  Q_OBJECT
149 
150  public:
151 
152  QgsProcessingCrsWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
153  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
154 
155  // QgsProcessingParameterWidgetFactoryInterface
156  QString parameterType() const override;
158  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
159  QgsProcessingContext &context,
160  const QgsProcessingParameterWidgetContext &widgetContext,
161  const QgsProcessingParameterDefinition *definition = nullptr,
162  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
163 
164  // QgsProcessingParameterWidgetWrapper interface
165  QWidget *createWidget() override SIP_FACTORY;
166 
167  protected:
168 
169  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
170  QVariant widgetValue() const override;
171 
172  QStringList compatibleParameterTypes() const override;
173  QStringList compatibleOutputTypes() const override;
174  QString modelerExpressionFormatString() const override;
175 
176  private:
177 
178  QgsProjectionSelectionWidget *mProjectionSelectionWidget = nullptr;
179  QCheckBox *mUseProjectCrsCheckBox = nullptr;
180 
181  friend class TestProcessingGui;
182 };
183 
184 
185 
186 class GUI_EXPORT QgsProcessingStringParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
187 {
188  Q_OBJECT
189  public:
190 
191  QgsProcessingStringParameterDefinitionWidget( QgsProcessingContext &context,
192  const QgsProcessingParameterWidgetContext &widgetContext,
193  const QgsProcessingParameterDefinition *definition = nullptr,
194  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
195  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
196 
197  private:
198 
199  QLineEdit *mDefaultLineEdit = nullptr;
200  QCheckBox *mMultiLineCheckBox = nullptr;
201 
202 };
203 
204 class GUI_EXPORT QgsProcessingStringWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
205 {
206  Q_OBJECT
207 
208  public:
209 
210  QgsProcessingStringWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
211  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
212 
213  // QgsProcessingParameterWidgetFactoryInterface
214  QString parameterType() const override;
216  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
217  QgsProcessingContext &context,
218  const QgsProcessingParameterWidgetContext &widgetContext,
219  const QgsProcessingParameterDefinition *definition = nullptr,
220  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
221 
222  // QgsProcessingParameterWidgetWrapper interface
223  QWidget *createWidget() override SIP_FACTORY;
224 
225  protected:
226 
227  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
228  QVariant widgetValue() const override;
229 
230  QStringList compatibleParameterTypes() const override;
231 
232  QStringList compatibleOutputTypes() const override;
233  private:
234 
235  QLineEdit *mLineEdit = nullptr;
236  QPlainTextEdit *mPlainTextEdit = nullptr;
237 
238  friend class TestProcessingGui;
239 };
240 
241 
242 class GUI_EXPORT QgsProcessingAuthConfigWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
243 {
244  Q_OBJECT
245 
246  public:
247 
248  QgsProcessingAuthConfigWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
249  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
250 
251  // QgsProcessingParameterWidgetFactoryInterface
252  QString parameterType() const override;
254 
255  // QgsProcessingParameterWidgetWrapper interface
256  QWidget *createWidget() override SIP_FACTORY;
257 
258  protected:
259 
260  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
261  QVariant widgetValue() const override;
262 
263  QStringList compatibleParameterTypes() const override;
264 
265  QStringList compatibleOutputTypes() const override;
266  private:
267 
268  QgsAuthConfigSelect *mAuthConfigSelect = nullptr;
269 
270  friend class TestProcessingGui;
271 };
272 
273 
274 class GUI_EXPORT QgsProcessingNumberParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
275 {
276  Q_OBJECT
277  public:
278 
279  QgsProcessingNumberParameterDefinitionWidget( QgsProcessingContext &context,
280  const QgsProcessingParameterWidgetContext &widgetContext,
281  const QgsProcessingParameterDefinition *definition = nullptr,
282  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
283  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
284 
285  private:
286 
287  QComboBox *mTypeComboBox = nullptr;
288  QLineEdit *mMinLineEdit = nullptr;
289  QLineEdit *mMaxLineEdit = nullptr;
290  QLineEdit *mDefaultLineEdit = nullptr;
291 
292 };
293 
294 
295 class GUI_EXPORT QgsProcessingNumericWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
296 {
297  Q_OBJECT
298 
299  public:
300 
301  QgsProcessingNumericWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
302  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
303 
304  // QgsProcessingParameterWidgetFactoryInterface
305  QString parameterType() const override;
307  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
308  QgsProcessingContext &context,
309  const QgsProcessingParameterWidgetContext &widgetContext,
310  const QgsProcessingParameterDefinition *definition = nullptr,
311  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
312 
313  // QgsProcessingParameterWidgetWrapper interface
314  QWidget *createWidget() override SIP_FACTORY;
315 
316  protected:
317 
318  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
319  QVariant widgetValue() const override;
320 
321  QStringList compatibleParameterTypes() const override;
322 
323  QStringList compatibleOutputTypes() const override;
324 
325  protected:
326 
327  QgsSpinBox *mSpinBox = nullptr;
328  QgsDoubleSpinBox *mDoubleSpinBox = nullptr;
329 
330  private:
331 
332  static double calculateStep( double minimum, double maximum );
333 
334  bool mAllowingNull = false;
335 
336  friend class TestProcessingGui;
337 };
338 
339 
340 class GUI_EXPORT QgsProcessingDistanceParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
341 {
342  Q_OBJECT
343  public:
344 
345  QgsProcessingDistanceParameterDefinitionWidget( QgsProcessingContext &context,
346  const QgsProcessingParameterWidgetContext &widgetContext,
347  const QgsProcessingParameterDefinition *definition = nullptr,
348  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
349  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
350 
351  private:
352 
353  QComboBox *mParentLayerComboBox = nullptr;
354  QLineEdit *mMinLineEdit = nullptr;
355  QLineEdit *mMaxLineEdit = nullptr;
356  QLineEdit *mDefaultLineEdit = nullptr;
357 
358 };
359 
360 class GUI_EXPORT QgsProcessingDistanceWidgetWrapper : public QgsProcessingNumericWidgetWrapper
361 {
362  Q_OBJECT
363 
364  public:
365 
366  QgsProcessingDistanceWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
367  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
368 
369  // QgsProcessingParameterWidgetFactoryInterface
370  QString parameterType() const override;
372  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
373  QgsProcessingContext &context,
374  const QgsProcessingParameterWidgetContext &widgetContext,
375  const QgsProcessingParameterDefinition *definition = nullptr,
376  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
377 
378  // QgsProcessingParameterWidgetWrapper interface
379  QWidget *createWidget() override SIP_FACTORY;
380  void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
381 
382  public slots:
383  void setUnitParameterValue( const QVariant &value );
384  void setUnits( QgsUnitTypes::DistanceUnit unit );
385 
386  protected:
387 
388  QVariant widgetValue() const override;
389 
390  private:
391 
392  QgsUnitTypes::DistanceUnit mBaseUnit = QgsUnitTypes::DistanceUnknownUnit;
393  QLabel *mLabel = nullptr;
394  QWidget *mWarningLabel = nullptr;
395  QComboBox *mUnitsCombo = nullptr;
396 
397  friend class TestProcessingGui;
398 };
399 
400 
401 class GUI_EXPORT QgsProcessingScaleParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
402 {
403  Q_OBJECT
404  public:
405 
406  QgsProcessingScaleParameterDefinitionWidget( QgsProcessingContext &context,
407  const QgsProcessingParameterWidgetContext &widgetContext,
408  const QgsProcessingParameterDefinition *definition = nullptr,
409  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
410  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
411 
412  private:
413 
414  QLineEdit *mDefaultLineEdit = nullptr;
415 
416 };
417 
418 class GUI_EXPORT QgsProcessingScaleWidgetWrapper : public QgsProcessingNumericWidgetWrapper
419 {
420  Q_OBJECT
421 
422  public:
423 
424  QgsProcessingScaleWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
425  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
426 
427  // QgsProcessingParameterWidgetFactoryInterface
428  QString parameterType() const override;
430  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
431  QgsProcessingContext &context,
432  const QgsProcessingParameterWidgetContext &widgetContext,
433  const QgsProcessingParameterDefinition *definition = nullptr,
434  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
435 
436  // QgsProcessingParameterWidgetWrapper interface
437  QWidget *createWidget() override SIP_FACTORY;
438  void setWidgetContext( const QgsProcessingParameterWidgetContext &context ) override;
439  protected:
440 
441  QVariant widgetValue() const override;
442  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
443 
444  private:
445 
446  QgsScaleWidget *mScaleWidget = nullptr;
447 
448  friend class TestProcessingGui;
449 };
450 
451 
452 class GUI_EXPORT QgsProcessingRangeParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
453 {
454  Q_OBJECT
455  public:
456 
457  QgsProcessingRangeParameterDefinitionWidget( QgsProcessingContext &context,
458  const QgsProcessingParameterWidgetContext &widgetContext,
459  const QgsProcessingParameterDefinition *definition = nullptr,
460  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
461  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
462 
463  private:
464 
465  QComboBox *mTypeComboBox = nullptr;
466  QLineEdit *mMinLineEdit = nullptr;
467  QLineEdit *mMaxLineEdit = nullptr;
468 
469 };
470 
471 class GUI_EXPORT QgsProcessingRangeWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
472 {
473  Q_OBJECT
474 
475  public:
476 
477  QgsProcessingRangeWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
478  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
479 
480  // QgsProcessingParameterWidgetFactoryInterface
481  QString parameterType() const override;
483  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
484  QgsProcessingContext &context,
485  const QgsProcessingParameterWidgetContext &widgetContext,
486  const QgsProcessingParameterDefinition *definition = nullptr,
487  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
488 
489  // QgsProcessingParameterWidgetWrapper interface
490  QWidget *createWidget() override SIP_FACTORY;
491 
492  protected:
493 
494  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
495  QVariant widgetValue() const override;
496  QStringList compatibleParameterTypes() const override;
497  QStringList compatibleOutputTypes() const override;
498  QString modelerExpressionFormatString() const override;
499 
500  protected:
501 
502  QgsDoubleSpinBox *mMinSpinBox = nullptr;
503  QgsDoubleSpinBox *mMaxSpinBox = nullptr;
504 
505  private:
506 
507  int mBlockChangedSignal = 0;
508  bool mAllowingNull = false;
509 
510  friend class TestProcessingGui;
511 };
512 
513 class GUI_EXPORT QgsProcessingMatrixParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
514 {
515  Q_OBJECT
516  public:
517 
518  QgsProcessingMatrixParameterDefinitionWidget( QgsProcessingContext &context,
519  const QgsProcessingParameterWidgetContext &widgetContext,
520  const QgsProcessingParameterDefinition *definition = nullptr,
521  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
522  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
523 
524  private:
525 
526  QgsProcessingMatrixModelerWidget *mMatrixWidget = nullptr;
527 
528 };
529 
530 class GUI_EXPORT QgsProcessingMatrixWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
531 {
532  Q_OBJECT
533 
534  public:
535 
536  QgsProcessingMatrixWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
537  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
538 
539  // QgsProcessingParameterWidgetFactoryInterface
540  QString parameterType() const override;
542  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
543  QgsProcessingContext &context,
544  const QgsProcessingParameterWidgetContext &widgetContext,
545  const QgsProcessingParameterDefinition *definition = nullptr,
546  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
547 
548  // QgsProcessingParameterWidgetWrapper interface
549  QWidget *createWidget() override SIP_FACTORY;
550 
551  protected:
552 
553  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
554  QVariant widgetValue() const override;
555 
556  QStringList compatibleParameterTypes() const override;
557  QStringList compatibleOutputTypes() const override;
558  QString modelerExpressionFormatString() const override;
559 
560  private:
561 
562  QgsProcessingMatrixParameterPanel *mMatrixWidget = nullptr;
563 
564  friend class TestProcessingGui;
565 };
566 
567 class GUI_EXPORT QgsProcessingFileParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
568 {
569  Q_OBJECT
570  public:
571 
572  QgsProcessingFileParameterDefinitionWidget( QgsProcessingContext &context,
573  const QgsProcessingParameterWidgetContext &widgetContext,
574  const QgsProcessingParameterDefinition *definition = nullptr,
575  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
576  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
577 
578  private:
579 
580  QComboBox *mTypeComboBox = nullptr;
581  QComboBox *mFilterComboBox = nullptr;
582  QgsFileWidget *mDefaultFileWidget = nullptr;
583 
584 };
585 
586 class GUI_EXPORT QgsProcessingFileWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
587 {
588  Q_OBJECT
589 
590  public:
591 
592  QgsProcessingFileWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
593  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
594 
595  // QgsProcessingParameterWidgetFactoryInterface
596  QString parameterType() const override;
598  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
599  QgsProcessingContext &context,
600  const QgsProcessingParameterWidgetContext &widgetContext,
601  const QgsProcessingParameterDefinition *definition = nullptr,
602  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
603 
604  // QgsProcessingParameterWidgetWrapper interface
605  QWidget *createWidget() override SIP_FACTORY;
606 
607  protected:
608 
609  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
610  QVariant widgetValue() const override;
611 
612  QStringList compatibleParameterTypes() const override;
613 
614  QStringList compatibleOutputTypes() const override;
615  QString modelerExpressionFormatString() const override;
616 
617  private:
618 
619  QgsFileWidget *mFileWidget = nullptr;
620 
621  friend class TestProcessingGui;
622 };
623 
624 
625 
626 class GUI_EXPORT QgsProcessingExpressionParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
627 {
628  Q_OBJECT
629  public:
630 
631  QgsProcessingExpressionParameterDefinitionWidget( QgsProcessingContext &context,
632  const QgsProcessingParameterWidgetContext &widgetContext,
633  const QgsProcessingParameterDefinition *definition = nullptr,
634  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
635  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
636 
637  private:
638 
639  QComboBox *mParentLayerComboBox = nullptr;
640  QgsExpressionLineEdit *mDefaultLineEdit = nullptr;
641 
642 };
643 
644 class GUI_EXPORT QgsProcessingExpressionWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
645 {
646  Q_OBJECT
647 
648  public:
649 
650  QgsProcessingExpressionWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
651  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
652 
653  // QgsProcessingParameterWidgetFactoryInterface
654  QString parameterType() const override;
656  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
657  QgsProcessingContext &context,
658  const QgsProcessingParameterWidgetContext &widgetContext,
659  const QgsProcessingParameterDefinition *definition = nullptr,
660  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
661 
662  // QgsProcessingParameterWidgetWrapper interface
663  QWidget *createWidget() override SIP_FACTORY;
664  void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
665  void registerProcessingContextGenerator( QgsProcessingContextGenerator *generator ) override;
666 
667  public slots:
668  void setParentLayerWrapperValue( const QgsAbstractProcessingParameterWidgetWrapper *parentWrapper );
669  protected:
670 
671  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
672  QVariant widgetValue() const override;
673 
674  QStringList compatibleParameterTypes() const override;
675 
676  QStringList compatibleOutputTypes() const override;
677 
678  QString modelerExpressionFormatString() const override;
679  const QgsVectorLayer *linkedVectorLayer() const override;
680  private:
681 
682  QgsFieldExpressionWidget *mFieldExpWidget = nullptr;
683  QgsExpressionBuilderWidget *mExpBuilderWidget = nullptr;
684  QgsExpressionLineEdit *mExpLineEdit = nullptr;
685  std::unique_ptr< QgsVectorLayer > mParentLayer;
686 
687  friend class TestProcessingGui;
688 };
689 
690 
691 class GUI_EXPORT QgsProcessingEnumCheckboxPanelWidget : public QWidget
692 {
693  Q_OBJECT
694 
695  public:
696 
697  QgsProcessingEnumCheckboxPanelWidget( QWidget *parent = nullptr, const QgsProcessingParameterEnum *param = nullptr, int columns = 2 );
698  QVariant value() const;
699  void setValue( const QVariant &value );
700 
701  signals:
702 
703  void changed();
704 
705  private slots:
706 
707  void showPopupMenu();
708  void selectAll();
709  void deselectAll();
710 
711  private:
712 
713  const QgsProcessingParameterEnum *mParam = nullptr;
714  QMap< QVariant, QAbstractButton * > mButtons;
715  QButtonGroup *mButtonGroup = nullptr;
716  int mColumns = 2;
717  bool mBlockChangedSignal = false;
718 
719  friend class TestProcessingGui;
720 };
721 
722 class GUI_EXPORT QgsProcessingEnumPanelWidget : public QWidget
723 {
724  Q_OBJECT
725 
726  public:
727 
728  QgsProcessingEnumPanelWidget( QWidget *parent = nullptr, const QgsProcessingParameterEnum *param = nullptr );
729  QVariant value() const { return mValue; }
730  void setValue( const QVariant &value );
731 
732  signals:
733 
734  void changed();
735 
736  private slots:
737 
738  void showDialog();
739 
740  private:
741 
742  void updateSummaryText();
743 
744  const QgsProcessingParameterEnum *mParam = nullptr;
745  QLineEdit *mLineEdit = nullptr;
746  QToolButton *mToolButton = nullptr;
747 
748  QVariantList mValue;
749 
750  friend class TestProcessingGui;
751 };
752 
753 class GUI_EXPORT QgsProcessingEnumParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
754 {
755  Q_OBJECT
756  public:
757 
758  QgsProcessingEnumParameterDefinitionWidget( QgsProcessingContext &context,
759  const QgsProcessingParameterWidgetContext &widgetContext,
760  const QgsProcessingParameterDefinition *definition = nullptr,
761  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
762  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
763 
764  private:
765 
766  QgsProcessingEnumModelerWidget *mEnumWidget = nullptr;
767 
768 };
769 
770 class GUI_EXPORT QgsProcessingEnumWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
771 {
772  Q_OBJECT
773 
774  public:
775 
776  QgsProcessingEnumWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
777  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
778 
779  // QgsProcessingParameterWidgetFactoryInterface
780  QString parameterType() const override;
782  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
783  QgsProcessingContext &context,
784  const QgsProcessingParameterWidgetContext &widgetContext,
785  const QgsProcessingParameterDefinition *definition = nullptr,
786  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
787 
788  // QgsProcessingParameterWidgetWrapper interface
789  QWidget *createWidget() override SIP_FACTORY;
790 
791  protected:
792 
793  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
794  QVariant widgetValue() const override;
795 
796  QStringList compatibleParameterTypes() const override;
797 
798  QStringList compatibleOutputTypes() const override;
799 
800  QString modelerExpressionFormatString() const override;
801  private:
802 
803  QComboBox *mComboBox = nullptr;
804  QgsProcessingEnumPanelWidget *mPanel = nullptr;
805  QgsProcessingEnumCheckboxPanelWidget *mCheckboxPanel = nullptr;
806 
807  friend class TestProcessingGui;
808 };
809 
810 
811 
812 class GUI_EXPORT QgsProcessingLayoutWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
813 {
814  Q_OBJECT
815 
816  public:
817 
818  QgsProcessingLayoutWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
819  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
820 
821  // QgsProcessingParameterWidgetFactoryInterface
822  QString parameterType() const override;
824 
825  // QgsProcessingParameterWidgetWrapper interface
826  QWidget *createWidget() override SIP_FACTORY;
827 
828  protected:
829 
830  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
831  QVariant widgetValue() const override;
832  void setWidgetContext( const QgsProcessingParameterWidgetContext &context ) override;
833 
834  QStringList compatibleParameterTypes() const override;
835 
836  QStringList compatibleOutputTypes() const override;
837 
838  QString modelerExpressionFormatString() const override;
839  private:
840 
841  QgsLayoutComboBox *mComboBox = nullptr;
842  QComboBox *mPlainComboBox = nullptr;
843 
844  friend class TestProcessingGui;
845 };
846 
847 
848 
849 class GUI_EXPORT QgsProcessingLayoutItemParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
850 {
851  Q_OBJECT
852  public:
853 
854  QgsProcessingLayoutItemParameterDefinitionWidget( QgsProcessingContext &context,
855  const QgsProcessingParameterWidgetContext &widgetContext,
856  const QgsProcessingParameterDefinition *definition = nullptr,
857  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
858  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
859 
860  private:
861 
862  QComboBox *mParentLayoutComboBox = nullptr;
863 
864 };
865 
866 class GUI_EXPORT QgsProcessingLayoutItemWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
867 {
868  Q_OBJECT
869 
870  public:
871 
872  QgsProcessingLayoutItemWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
873  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
874 
875  // QgsProcessingParameterWidgetFactoryInterface
876  QString parameterType() const override;
878  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
879  QgsProcessingContext &context,
880  const QgsProcessingParameterWidgetContext &widgetContext,
881  const QgsProcessingParameterDefinition *definition = nullptr,
882  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
883 
884  // QgsProcessingParameterWidgetWrapper interface
885  QWidget *createWidget() override SIP_FACTORY;
886  void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
887 
888 
889  public slots:
890  void setLayoutParameterValue( const QVariant &value );
891  void setLayout( QgsPrintLayout *layout );
892 
893  protected:
894 
895  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
896  QVariant widgetValue() const override;
897 
898  QStringList compatibleParameterTypes() const override;
899 
900  QStringList compatibleOutputTypes() const override;
901  QString modelerExpressionFormatString() const override;
902  private:
903 
904  QgsLayoutItemComboBox *mComboBox = nullptr;
905  QLineEdit *mLineEdit = nullptr;
906 
907  friend class TestProcessingGui;
908 };
909 
910 class GUI_EXPORT QgsProcessingPointMapTool : public QgsMapTool
911 {
912  Q_OBJECT
913  public:
914  QgsProcessingPointMapTool( QgsMapCanvas *canvas );
915  ~QgsProcessingPointMapTool() override;
916  void deactivate() override;
917  void canvasMoveEvent( QgsMapMouseEvent *e ) override;
918  void canvasPressEvent( QgsMapMouseEvent *e ) override;
919  void keyPressEvent( QKeyEvent *e ) override;
920 
921  signals:
922 
923  void clicked( const QgsPointXY &point );
924  void complete();
925 
926  private:
927 
928  std::unique_ptr<QgsSnapIndicator> mSnapIndicator;
929  friend class TestProcessingGui;
930 };
931 
932 class GUI_EXPORT QgsProcessingPointPanel : public QWidget
933 {
934  Q_OBJECT
935 
936  public:
937 
938  QgsProcessingPointPanel( QWidget *parent );
939  void setMapCanvas( QgsMapCanvas *canvas );
940  void setAllowNull( bool allowNull );
941 
942  QVariant value() const;
943  void clear();
944  void setValue( const QgsPointXY &point, const QgsCoordinateReferenceSystem &crs );
945 
946  signals:
947 
948  void toggleDialogVisibility( bool visible );
949  void changed();
950 
951  private slots:
952 
953  void selectOnCanvas();
954  void updatePoint( const QgsPointXY &point );
955  void pointPicked();
956 
957  private:
958 
959  QgsFilterLineEdit *mLineEdit = nullptr;
960  QToolButton *mButton = nullptr;
961  QgsMapCanvas *mCanvas = nullptr;
963  QPointer< QgsMapTool > mPrevTool;
964  std::unique_ptr< QgsProcessingPointMapTool > mTool;
965  friend class TestProcessingGui;
966 };
967 
968 
969 class GUI_EXPORT QgsProcessingPointParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
970 {
971  Q_OBJECT
972  public:
973 
974  QgsProcessingPointParameterDefinitionWidget( QgsProcessingContext &context,
975  const QgsProcessingParameterWidgetContext &widgetContext,
976  const QgsProcessingParameterDefinition *definition = nullptr,
977  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
978  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
979 
980  private:
981 
982  QLineEdit *mDefaultLineEdit = nullptr;
983 
984 };
985 
986 class GUI_EXPORT QgsProcessingPointWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
987 {
988  Q_OBJECT
989 
990  public:
991 
992  QgsProcessingPointWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
993  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
994 
995  // QgsProcessingParameterWidgetFactoryInterface
996  QString parameterType() const override;
998  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
999  QgsProcessingContext &context,
1000  const QgsProcessingParameterWidgetContext &widgetContext,
1001  const QgsProcessingParameterDefinition *definition = nullptr,
1002  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1003 
1004  // QgsProcessingParameterWidgetWrapper interface
1005  QWidget *createWidget() override SIP_FACTORY;
1006  void setWidgetContext( const QgsProcessingParameterWidgetContext &context ) override;
1007  void setDialog( QDialog *dialog ) override;
1008 
1009  protected:
1010 
1011  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1012  QVariant widgetValue() const override;
1013 
1014  QStringList compatibleParameterTypes() const override;
1015 
1016  QStringList compatibleOutputTypes() const override;
1017  QString modelerExpressionFormatString() const override;
1018  private:
1019 
1020  QgsProcessingPointPanel *mPanel = nullptr;
1021  QLineEdit *mLineEdit = nullptr;
1022  QDialog *mDialog = nullptr;
1023 
1024  friend class TestProcessingGui;
1025 };
1026 
1027 class GUI_EXPORT QgsProcessingGeometryParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1028 {
1029  Q_OBJECT
1030  public:
1031 
1032  QgsProcessingGeometryParameterDefinitionWidget( QgsProcessingContext &context,
1033  const QgsProcessingParameterWidgetContext &widgetContext,
1034  const QgsProcessingParameterDefinition *definition = nullptr,
1035  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1036  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
1037 
1038  private:
1039 
1040  QLineEdit *mDefaultLineEdit = nullptr;
1041 
1042 };
1043 
1044 class GUI_EXPORT QgsProcessingGeometryWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1045 {
1046  Q_OBJECT
1047 
1048  public:
1049 
1050  QgsProcessingGeometryWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1051  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1052 
1053  // QgsProcessingParameterWidgetFactoryInterface
1054  QString parameterType() const override;
1056  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1057  QgsProcessingContext &context,
1058  const QgsProcessingParameterWidgetContext &widgetContext,
1059  const QgsProcessingParameterDefinition *definition = nullptr,
1060  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1061 
1062  // QgsProcessingParameterWidgetWrapper interface
1063  QWidget *createWidget() override SIP_FACTORY;
1064 
1065  protected:
1066 
1067  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1068  QVariant widgetValue() const override;
1069 
1070  QStringList compatibleParameterTypes() const override;
1071 
1072  QStringList compatibleOutputTypes() const override;
1073  QString modelerExpressionFormatString() const override;
1074  private:
1075 
1076  QLineEdit *mLineEdit = nullptr;
1077 
1078  friend class TestProcessingGui;
1079 };
1080 
1081 class GUI_EXPORT QgsProcessingExtentParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1082 {
1083  Q_OBJECT
1084  public:
1085 
1086  QgsProcessingExtentParameterDefinitionWidget( QgsProcessingContext &context,
1087  const QgsProcessingParameterWidgetContext &widgetContext,
1088  const QgsProcessingParameterDefinition *definition = nullptr,
1089  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1090  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
1091 
1092  private:
1093 
1094  QgsExtentWidget *mDefaultWidget = nullptr;
1095 
1096 };
1097 
1098 class GUI_EXPORT QgsProcessingExtentWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1099 {
1100  Q_OBJECT
1101 
1102  public:
1103 
1104  QgsProcessingExtentWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1105  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1106 
1107  // QgsProcessingParameterWidgetFactoryInterface
1108  QString parameterType() const override;
1110  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1111  QgsProcessingContext &context,
1112  const QgsProcessingParameterWidgetContext &widgetContext,
1113  const QgsProcessingParameterDefinition *definition = nullptr,
1114  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1115 
1116  // QgsProcessingParameterWidgetWrapper interface
1117  QWidget *createWidget() override SIP_FACTORY;
1118  void setWidgetContext( const QgsProcessingParameterWidgetContext &context ) override;
1119  void setDialog( QDialog *dialog ) override;
1120 
1121  protected:
1122 
1123  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1124  QVariant widgetValue() const override;
1125 
1126  QStringList compatibleParameterTypes() const override;
1127 
1128  QStringList compatibleOutputTypes() const override;
1129  QString modelerExpressionFormatString() const override;
1130  private:
1131 
1132  QgsExtentWidget *mExtentWidget = nullptr;
1133  QDialog *mDialog = nullptr;
1134 
1135  friend class TestProcessingGui;
1136 };
1137 
1138 class GUI_EXPORT QgsProcessingColorParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1139 {
1140  Q_OBJECT
1141  public:
1142 
1143  QgsProcessingColorParameterDefinitionWidget( QgsProcessingContext &context,
1144  const QgsProcessingParameterWidgetContext &widgetContext,
1145  const QgsProcessingParameterDefinition *definition = nullptr,
1146  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1147  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
1148 
1149  private:
1150 
1151  QgsColorButton *mDefaultColorButton = nullptr;
1152  QCheckBox *mAllowOpacity = nullptr;
1153 
1154 };
1155 
1156 class GUI_EXPORT QgsProcessingColorWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1157 {
1158  Q_OBJECT
1159 
1160  public:
1161 
1162  QgsProcessingColorWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1163  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1164 
1165  // QgsProcessingParameterWidgetFactoryInterface
1166  QString parameterType() const override;
1168  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1169  QgsProcessingContext &context,
1170  const QgsProcessingParameterWidgetContext &widgetContext,
1171  const QgsProcessingParameterDefinition *definition = nullptr,
1172  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1173 
1174  // QgsProcessingParameterWidgetWrapper interface
1175  QWidget *createWidget() override SIP_FACTORY;
1176 
1177  protected:
1178 
1179  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1180  QVariant widgetValue() const override;
1181 
1182  QStringList compatibleParameterTypes() const override;
1183 
1184  QStringList compatibleOutputTypes() const override;
1185  QString modelerExpressionFormatString() const override;
1186  private:
1187 
1188  QgsColorButton *mColorButton = nullptr;
1189  friend class TestProcessingGui;
1190 };
1191 
1192 
1193 
1194 class GUI_EXPORT QgsProcessingCoordinateOperationParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1195 {
1196  Q_OBJECT
1197  public:
1198 
1199  QgsProcessingCoordinateOperationParameterDefinitionWidget( QgsProcessingContext &context,
1200  const QgsProcessingParameterWidgetContext &widgetContext,
1201  const QgsProcessingParameterDefinition *definition = nullptr,
1202  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1203  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
1204 
1205  private:
1206 
1207  QLineEdit *mDefaultLineEdit = nullptr;
1208 
1209  QComboBox *mSourceParamComboBox = nullptr;
1210  QComboBox *mDestParamComboBox = nullptr;
1211 
1212  QgsProjectionSelectionWidget *mStaticSourceWidget = nullptr;
1213  QgsProjectionSelectionWidget *mStaticDestWidget = nullptr;
1214 
1215 
1216 };
1217 
1218 class GUI_EXPORT QgsProcessingCoordinateOperationWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1219 {
1220  Q_OBJECT
1221 
1222  public:
1223 
1224  QgsProcessingCoordinateOperationWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1225  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1226 
1227  // QgsProcessingParameterWidgetFactoryInterface
1228  QString parameterType() const override;
1230  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1231  QgsProcessingContext &context,
1232  const QgsProcessingParameterWidgetContext &widgetContext,
1233  const QgsProcessingParameterDefinition *definition = nullptr,
1234  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1235 
1236  // QgsProcessingParameterWidgetWrapper interface
1237  QWidget *createWidget() override SIP_FACTORY;
1238  void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
1239  void setWidgetContext( const QgsProcessingParameterWidgetContext &context ) override;
1240  protected:
1241 
1242  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1243  QVariant widgetValue() const override;
1244 
1245  QStringList compatibleParameterTypes() const override;
1246 
1247  QStringList compatibleOutputTypes() const override;
1248  QString modelerExpressionFormatString() const override;
1249  private:
1250 
1251  void setSourceCrsParameterValue( const QVariant &value );
1252  void setDestinationCrsParameterValue( const QVariant &value );
1253 
1254  QgsCoordinateOperationWidget *mOperationWidget = nullptr;
1255  QgsMapCanvas *mCanvas = nullptr;
1256  QLineEdit *mLineEdit = nullptr;
1257  QgsCoordinateReferenceSystem mSourceCrs;
1259  friend class TestProcessingGui;
1260 };
1261 
1262 class GUI_EXPORT QgsProcessingFieldPanelWidget : public QWidget
1263 {
1264  Q_OBJECT
1265 
1266  public:
1267 
1268  QgsProcessingFieldPanelWidget( QWidget *parent = nullptr, const QgsProcessingParameterField *param = nullptr );
1269 
1270  void setFields( const QgsFields &fields );
1271 
1272  QgsFields fields() const { return mFields; }
1273 
1274  QVariant value() const { return mValue; }
1275  void setValue( const QVariant &value );
1276 
1277  signals:
1278 
1279  void changed();
1280 
1281  private slots:
1282 
1283  void showDialog();
1284 
1285  private:
1286 
1287  void updateSummaryText();
1288 
1289  QgsFields mFields;
1290 
1291  const QgsProcessingParameterField *mParam = nullptr;
1292  QLineEdit *mLineEdit = nullptr;
1293  QToolButton *mToolButton = nullptr;
1294 
1295  QVariantList mValue;
1296 
1297  friend class TestProcessingGui;
1298 };
1299 
1300 class GUI_EXPORT QgsProcessingFieldParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1301 {
1302  Q_OBJECT
1303  public:
1304 
1305  QgsProcessingFieldParameterDefinitionWidget( QgsProcessingContext &context,
1306  const QgsProcessingParameterWidgetContext &widgetContext,
1307  const QgsProcessingParameterDefinition *definition = nullptr,
1308  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1309  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
1310 
1311  private:
1312 
1313  QComboBox *mParentLayerComboBox = nullptr;
1314  QComboBox *mDataTypeComboBox = nullptr;
1315  QLineEdit *mDefaultLineEdit = nullptr;
1316  QCheckBox *mAllowMultipleCheckBox = nullptr;
1317  QCheckBox *mDefaultToAllCheckBox = nullptr;
1318 };
1319 
1320 class GUI_EXPORT QgsProcessingFieldWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1321 {
1322  Q_OBJECT
1323 
1324  public:
1325 
1326  QgsProcessingFieldWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1327  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1328 
1329  // QgsProcessingParameterWidgetFactoryInterface
1330  QString parameterType() const override;
1332  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1333  QgsProcessingContext &context,
1334  const QgsProcessingParameterWidgetContext &widgetContext,
1335  const QgsProcessingParameterDefinition *definition = nullptr,
1336  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1337 
1338  // QgsProcessingParameterWidgetWrapper interface
1339  QWidget *createWidget() override SIP_FACTORY;
1340  void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
1341 
1342  public slots:
1343  void setParentLayerWrapperValue( const QgsAbstractProcessingParameterWidgetWrapper *parentWrapper );
1344 
1345  protected:
1346 
1347  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1348  QVariant widgetValue() const override;
1349 
1350  QStringList compatibleParameterTypes() const override;
1351 
1352  QStringList compatibleOutputTypes() const override;
1353  QString modelerExpressionFormatString() const override;
1354  const QgsVectorLayer *linkedVectorLayer() const override;
1355 
1356  private:
1357 
1358  QgsFieldComboBox *mComboBox = nullptr;
1359  QgsProcessingFieldPanelWidget *mPanel = nullptr;
1360  QLineEdit *mLineEdit = nullptr;
1361 
1362  std::unique_ptr< QgsVectorLayer > mParentLayer;
1363 
1364  QgsFields filterFields( const QgsFields &fields ) const;
1365 
1366  friend class TestProcessingGui;
1367 };
1368 
1369 
1370 class GUI_EXPORT QgsProcessingMapThemeParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1371 {
1372  Q_OBJECT
1373  public:
1374 
1375  QgsProcessingMapThemeParameterDefinitionWidget( QgsProcessingContext &context,
1376  const QgsProcessingParameterWidgetContext &widgetContext,
1377  const QgsProcessingParameterDefinition *definition = nullptr,
1378  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1379  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
1380 
1381  private:
1382 
1383  QComboBox *mDefaultComboBox = nullptr;
1384 
1385 };
1386 
1387 class GUI_EXPORT QgsProcessingMapThemeWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1388 {
1389  Q_OBJECT
1390 
1391  public:
1392 
1393  QgsProcessingMapThemeWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1394  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1395 
1396  // QgsProcessingParameterWidgetFactoryInterface
1397  QString parameterType() const override;
1399  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1400  QgsProcessingContext &context,
1401  const QgsProcessingParameterWidgetContext &widgetContext,
1402  const QgsProcessingParameterDefinition *definition = nullptr,
1403  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1404 
1405  // QgsProcessingParameterWidgetWrapper interface
1406  QWidget *createWidget() override SIP_FACTORY;
1407 
1408  protected:
1409 
1410  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1411  QVariant widgetValue() const override;
1412 
1413  QStringList compatibleParameterTypes() const override;
1414 
1415  QStringList compatibleOutputTypes() const override;
1416  QString modelerExpressionFormatString() const override;
1417 
1418  private:
1419 
1420  QComboBox *mComboBox = nullptr;
1421 
1422  friend class TestProcessingGui;
1423 };
1424 
1425 
1426 class GUI_EXPORT QgsProcessingDateTimeParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1427 {
1428  Q_OBJECT
1429  public:
1430 
1431  QgsProcessingDateTimeParameterDefinitionWidget( QgsProcessingContext &context,
1432  const QgsProcessingParameterWidgetContext &widgetContext,
1433  const QgsProcessingParameterDefinition *definition = nullptr,
1434  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1435  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
1436 
1437  private:
1438 
1439  QComboBox *mTypeComboBox = nullptr;
1440 
1441 };
1442 
1443 class GUI_EXPORT QgsProcessingDateTimeWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1444 {
1445  Q_OBJECT
1446 
1447  public:
1448 
1449  QgsProcessingDateTimeWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1450  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1451 
1452  // QgsProcessingParameterWidgetFactoryInterface
1453  QString parameterType() const override;
1455 
1456  // QgsProcessingParameterWidgetWrapper interface
1457  QWidget *createWidget() override SIP_FACTORY;
1458  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1459  QgsProcessingContext &context,
1460  const QgsProcessingParameterWidgetContext &widgetContext,
1461  const QgsProcessingParameterDefinition *definition = nullptr,
1462  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1463 
1464  protected:
1465 
1466  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1467  QVariant widgetValue() const override;
1468 
1469  QStringList compatibleParameterTypes() const override;
1470  QStringList compatibleOutputTypes() const override;
1471  QString modelerExpressionFormatString() const override;
1472 
1473  private:
1474 
1475  QgsDateTimeEdit *mDateTimeEdit = nullptr;
1476  QgsDateEdit *mDateEdit = nullptr;
1477  QgsTimeEdit *mTimeEdit = nullptr;
1478 
1479  friend class TestProcessingGui;
1480 };
1481 
1482 
1483 
1484 //
1485 // QgsProcessingProviderConnectionWidgetWrapper
1486 //
1487 
1488 class GUI_EXPORT QgsProcessingProviderConnectionParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1489 {
1490  Q_OBJECT
1491  public:
1492 
1493  QgsProcessingProviderConnectionParameterDefinitionWidget( QgsProcessingContext &context,
1494  const QgsProcessingParameterWidgetContext &widgetContext,
1495  const QgsProcessingParameterDefinition *definition = nullptr,
1496  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1497  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
1498 
1499  private:
1500 
1501  QComboBox *mProviderComboBox = nullptr;
1502  QLineEdit *mDefaultEdit = nullptr;
1503 
1504 };
1505 
1506 class GUI_EXPORT QgsProcessingProviderConnectionWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1507 {
1508  Q_OBJECT
1509 
1510  public:
1511 
1512  QgsProcessingProviderConnectionWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1513  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1514 
1515  // QgsProcessingParameterWidgetFactoryInterface
1516  QString parameterType() const override;
1518 
1519 
1520  // QgsProcessingParameterWidgetWrapper interface
1521  QWidget *createWidget() override SIP_FACTORY;
1522  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1523  QgsProcessingContext &context,
1524  const QgsProcessingParameterWidgetContext &widgetContext,
1525  const QgsProcessingParameterDefinition *definition = nullptr,
1526  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1527 
1528  protected:
1529 
1530  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1531  QVariant widgetValue() const override;
1532 
1533  QStringList compatibleParameterTypes() const override;
1534 
1535  QStringList compatibleOutputTypes() const override;
1536  QString modelerExpressionFormatString() const override;
1537 
1538  private:
1539 
1540  QgsProviderConnectionComboBox *mProviderComboBox = nullptr;
1541  int mBlockSignals = 0;
1542 
1543  friend class TestProcessingGui;
1544 };
1545 
1546 
1547 
1548 class GUI_EXPORT QgsProcessingDatabaseSchemaParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1549 {
1550  Q_OBJECT
1551  public:
1552 
1553  QgsProcessingDatabaseSchemaParameterDefinitionWidget( QgsProcessingContext &context,
1554  const QgsProcessingParameterWidgetContext &widgetContext,
1555  const QgsProcessingParameterDefinition *definition = nullptr,
1556  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1557  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
1558 
1559  private:
1560 
1561  QComboBox *mConnectionParamComboBox = nullptr;
1562  QLineEdit *mDefaultEdit = nullptr;
1563 
1564 };
1565 
1566 class GUI_EXPORT QgsProcessingDatabaseSchemaWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1567 {
1568  Q_OBJECT
1569 
1570  public:
1571 
1572  QgsProcessingDatabaseSchemaWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1573  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1574 
1575  // QgsProcessingParameterWidgetFactoryInterface
1576  QString parameterType() const override;
1578  void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
1579 
1580 
1581  // QgsProcessingParameterWidgetWrapper interface
1582  QWidget *createWidget() override SIP_FACTORY;
1583  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1584  QgsProcessingContext &context,
1585  const QgsProcessingParameterWidgetContext &widgetContext,
1586  const QgsProcessingParameterDefinition *definition = nullptr,
1587  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1588 
1589  public slots:
1590  void setParentConnectionWrapperValue( const QgsAbstractProcessingParameterWidgetWrapper *parentWrapper );
1591 
1592  protected:
1593 
1594  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1595  QVariant widgetValue() const override;
1596 
1597  QStringList compatibleParameterTypes() const override;
1598 
1599  QStringList compatibleOutputTypes() const override;
1600  QString modelerExpressionFormatString() const override;
1601 
1602  private:
1603 
1604  QgsDatabaseSchemaComboBox *mSchemaComboBox = nullptr;
1605  int mBlockSignals = 0;
1606 
1607  friend class TestProcessingGui;
1608 };
1609 
1610 
1611 
1612 
1613 class GUI_EXPORT QgsProcessingDatabaseTableParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1614 {
1615  Q_OBJECT
1616  public:
1617 
1618  QgsProcessingDatabaseTableParameterDefinitionWidget( QgsProcessingContext &context,
1619  const QgsProcessingParameterWidgetContext &widgetContext,
1620  const QgsProcessingParameterDefinition *definition = nullptr,
1621  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1622  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
1623 
1624  private:
1625 
1626  QComboBox *mConnectionParamComboBox = nullptr;
1627  QComboBox *mSchemaParamComboBox = nullptr;
1628  QLineEdit *mDefaultEdit = nullptr;
1629 
1630 };
1631 
1632 class GUI_EXPORT QgsProcessingDatabaseTableWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1633 {
1634  Q_OBJECT
1635 
1636  public:
1637 
1638  QgsProcessingDatabaseTableWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1639  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1640 
1641  // QgsProcessingParameterWidgetFactoryInterface
1642  QString parameterType() const override;
1644  void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
1645 
1646 
1647  // QgsProcessingParameterWidgetWrapper interface
1648  QWidget *createWidget() override SIP_FACTORY;
1649  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1650  QgsProcessingContext &context,
1651  const QgsProcessingParameterWidgetContext &widgetContext,
1652  const QgsProcessingParameterDefinition *definition = nullptr,
1653  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1654 
1655  public slots:
1656  void setParentConnectionWrapperValue( const QgsAbstractProcessingParameterWidgetWrapper *parentWrapper );
1657  void setParentSchemaWrapperValue( const QgsAbstractProcessingParameterWidgetWrapper *parentWrapper );
1658 
1659  protected:
1660 
1661  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1662  QVariant widgetValue() const override;
1663 
1664  QStringList compatibleParameterTypes() const override;
1665 
1666  QStringList compatibleOutputTypes() const override;
1667  QString modelerExpressionFormatString() const override;
1668 
1669  private:
1670 
1671  QgsDatabaseTableComboBox *mTableComboBox = nullptr;
1672  int mBlockSignals = 0;
1673  QString mConnection;
1674  QString mProvider;
1675  QString mSchema;
1676 
1677  friend class TestProcessingGui;
1678 };
1679 
1680 class GUI_EXPORT QgsProcessingMapLayerParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1681 {
1682  Q_OBJECT
1683  public:
1684 
1685  QgsProcessingMapLayerParameterDefinitionWidget( QgsProcessingContext &context,
1686  const QgsProcessingParameterWidgetContext &widgetContext,
1687  const QgsProcessingParameterDefinition *definition = nullptr,
1688  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1689  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
1690 
1691  private:
1692 
1693  QgsCheckableComboBox *mLayerTypeComboBox = nullptr;
1694 };
1695 
1696 class GUI_EXPORT QgsProcessingMapLayerWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1697 {
1698  Q_OBJECT
1699 
1700  public:
1701 
1702  QgsProcessingMapLayerWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1703  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1704 
1705  // QgsProcessingParameterWidgetFactoryInterface
1706  QString parameterType() const override;
1708  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1709  QgsProcessingContext &context,
1710  const QgsProcessingParameterWidgetContext &widgetContext,
1711  const QgsProcessingParameterDefinition *definition = nullptr,
1712  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1713 
1714  void setWidgetContext( const QgsProcessingParameterWidgetContext &context ) override;
1715  // QgsProcessingParameterWidgetWrapper interface
1716  QWidget *createWidget() override SIP_FACTORY;
1717  protected:
1718 
1719  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1720  QVariant widgetValue() const override;
1721 
1722  QStringList compatibleParameterTypes() const override;
1723 
1724  QStringList compatibleOutputTypes() const override;
1725  QString modelerExpressionFormatString() const override;
1726 
1727  private:
1728 
1729  QPointer< QgsProcessingMapLayerComboBox > mComboBox;
1730  int mBlockSignals = 0;
1731 
1732  friend class TestProcessingGui;
1733 };
1734 
1735 
1736 class GUI_EXPORT QgsProcessingRasterLayerWidgetWrapper : public QgsProcessingMapLayerWidgetWrapper
1737 {
1738  Q_OBJECT
1739 
1740  public:
1741 
1742  QgsProcessingRasterLayerWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1743  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1744 
1745  // QgsProcessingParameterWidgetFactoryInterface
1746  QString parameterType() const override;
1748  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1749  QgsProcessingContext &context,
1750  const QgsProcessingParameterWidgetContext &widgetContext,
1751  const QgsProcessingParameterDefinition *definition = nullptr,
1752  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1753 
1754  protected:
1755  QStringList compatibleParameterTypes() const override;
1756 
1757  QStringList compatibleOutputTypes() const override;
1758 
1759  QString modelerExpressionFormatString() const override;
1760 
1761 };
1762 
1763 
1764 class GUI_EXPORT QgsProcessingVectorLayerParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1765 {
1766  Q_OBJECT
1767  public:
1768 
1769  QgsProcessingVectorLayerParameterDefinitionWidget( QgsProcessingContext &context,
1770  const QgsProcessingParameterWidgetContext &widgetContext,
1771  const QgsProcessingParameterDefinition *definition = nullptr,
1772  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1773  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
1774 
1775  private:
1776 
1777  QgsCheckableComboBox *mGeometryTypeComboBox = nullptr;
1778 };
1779 
1780 class GUI_EXPORT QgsProcessingVectorLayerWidgetWrapper : public QgsProcessingMapLayerWidgetWrapper
1781 {
1782  Q_OBJECT
1783 
1784  public:
1785 
1786  QgsProcessingVectorLayerWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1787  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1788 
1789  // QgsProcessingParameterWidgetFactoryInterface
1790  QString parameterType() const override;
1792  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1793  QgsProcessingContext &context,
1794  const QgsProcessingParameterWidgetContext &widgetContext,
1795  const QgsProcessingParameterDefinition *definition = nullptr,
1796  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1797 
1798  protected:
1799  QStringList compatibleParameterTypes() const override;
1800 
1801  QStringList compatibleOutputTypes() const override;
1802 
1803  QString modelerExpressionFormatString() const override;
1804  QList< int > compatibleDataTypes( const QgsProcessingParameterDefinition *parameter ) const override;
1805 };
1806 
1807 
1808 class GUI_EXPORT QgsProcessingFeatureSourceParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1809 {
1810  Q_OBJECT
1811  public:
1812 
1813  QgsProcessingFeatureSourceParameterDefinitionWidget( QgsProcessingContext &context,
1814  const QgsProcessingParameterWidgetContext &widgetContext,
1815  const QgsProcessingParameterDefinition *definition = nullptr,
1816  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1817  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
1818 
1819  private:
1820 
1821  QgsCheckableComboBox *mGeometryTypeComboBox = nullptr;
1822 };
1823 
1824 class GUI_EXPORT QgsProcessingFeatureSourceWidgetWrapper : public QgsProcessingMapLayerWidgetWrapper
1825 {
1826  Q_OBJECT
1827 
1828  public:
1829 
1830  QgsProcessingFeatureSourceWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1831  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1832 
1833  // QgsProcessingParameterWidgetFactoryInterface
1834  QString parameterType() const override;
1836  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1837  QgsProcessingContext &context,
1838  const QgsProcessingParameterWidgetContext &widgetContext,
1839  const QgsProcessingParameterDefinition *definition = nullptr,
1840  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1841 
1842  protected:
1843  QStringList compatibleParameterTypes() const override;
1844 
1845  QStringList compatibleOutputTypes() const override;
1846 
1847  QString modelerExpressionFormatString() const override;
1848  QList< int > compatibleDataTypes( const QgsProcessingParameterDefinition *parameter ) const override;
1849 };
1850 
1851 
1852 class GUI_EXPORT QgsProcessingMeshLayerWidgetWrapper : public QgsProcessingMapLayerWidgetWrapper
1853 {
1854  Q_OBJECT
1855 
1856  public:
1857 
1858  QgsProcessingMeshLayerWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1859  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1860 
1861  // QgsProcessingParameterWidgetFactoryInterface
1862  QString parameterType() const override;
1864  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1865  QgsProcessingContext &context,
1866  const QgsProcessingParameterWidgetContext &widgetContext,
1867  const QgsProcessingParameterDefinition *definition = nullptr,
1868  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1869 
1870  protected:
1871  QStringList compatibleParameterTypes() const override;
1872 
1873  QStringList compatibleOutputTypes() const override;
1874 
1875  QString modelerExpressionFormatString() const override;
1876 
1877 };
1878 
1879 
1880 class GUI_EXPORT QgsProcessingRasterBandPanelWidget : public QWidget
1881 {
1882  Q_OBJECT
1883 
1884  public:
1885 
1886  QgsProcessingRasterBandPanelWidget( QWidget *parent = nullptr, const QgsProcessingParameterBand *param = nullptr );
1887 
1888  void setBands( const QList< int > &bands );
1889  void setBandNames( const QHash<int, QString > &names );
1890  QList< int > bands() const { return mBands; }
1891 
1892  QVariant value() const { return mValue; }
1893  void setValue( const QVariant &value );
1894 
1895  signals:
1896 
1897  void changed();
1898 
1899  private slots:
1900 
1901  void showDialog();
1902 
1903  private:
1904 
1905  void updateSummaryText();
1906 
1907  QList< int > mBands;
1908  QHash<int, QString > mBandNames;
1909 
1910  const QgsProcessingParameterBand *mParam = nullptr;
1911  QLineEdit *mLineEdit = nullptr;
1912  QToolButton *mToolButton = nullptr;
1913 
1914  QVariantList mValue;
1915 
1916  friend class TestProcessingGui;
1917 };
1918 
1919 class GUI_EXPORT QgsProcessingBandParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1920 {
1921  Q_OBJECT
1922  public:
1923 
1924  QgsProcessingBandParameterDefinitionWidget( QgsProcessingContext &context,
1925  const QgsProcessingParameterWidgetContext &widgetContext,
1926  const QgsProcessingParameterDefinition *definition = nullptr,
1927  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1928  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
1929 
1930  private:
1931 
1932  QComboBox *mParentLayerComboBox = nullptr;
1933  QLineEdit *mDefaultLineEdit = nullptr;
1934  QCheckBox *mAllowMultipleCheckBox = nullptr;
1935 };
1936 
1937 class GUI_EXPORT QgsProcessingBandWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1938 {
1939  Q_OBJECT
1940 
1941  public:
1942 
1943  QgsProcessingBandWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1944  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1945 
1946  // QgsProcessingParameterWidgetFactoryInterface
1947  QString parameterType() const override;
1949  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1950  QgsProcessingContext &context,
1951  const QgsProcessingParameterWidgetContext &widgetContext,
1952  const QgsProcessingParameterDefinition *definition = nullptr,
1953  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1954 
1955  // QgsProcessingParameterWidgetWrapper interface
1956  QWidget *createWidget() override SIP_FACTORY;
1957  void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
1958 
1959  public slots:
1960  void setParentLayerWrapperValue( const QgsAbstractProcessingParameterWidgetWrapper *parentWrapper );
1961 
1962  protected:
1963 
1964  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1965  QVariant widgetValue() const override;
1966 
1967  QStringList compatibleParameterTypes() const override;
1968 
1969  QStringList compatibleOutputTypes() const override;
1970  QString modelerExpressionFormatString() const override;
1971 
1972  private:
1973 
1974  QgsRasterBandComboBox *mComboBox = nullptr;
1975  QgsProcessingRasterBandPanelWidget *mPanel = nullptr;
1976  QLineEdit *mLineEdit = nullptr;
1977 
1978  std::unique_ptr< QgsRasterLayer > mParentLayer;
1979 
1980  friend class TestProcessingGui;
1981 };
1982 
1983 
1984 
1985 class GUI_EXPORT QgsProcessingMultipleLayerPanelWidget : public QWidget
1986 {
1987  Q_OBJECT
1988 
1989  public:
1990 
1991  QgsProcessingMultipleLayerPanelWidget( QWidget *parent = nullptr, const QgsProcessingParameterMultipleLayers *param = nullptr );
1992 
1993  QVariant value() const { return mValue; }
1994  void setValue( const QVariant &value );
1995 
1996  void setProject( QgsProject *project );
1997  void setModel( QgsProcessingModelAlgorithm *model, const QString &modelChildAlgorithmID );
1998 
1999  signals:
2000 
2001  void changed();
2002 
2003  private slots:
2004 
2005  void showDialog();
2006 
2007  private:
2008 
2009  void updateSummaryText();
2010 
2011  const QgsProcessingParameterMultipleLayers *mParam = nullptr;
2012  QLineEdit *mLineEdit = nullptr;
2013  QToolButton *mToolButton = nullptr;
2014 
2015  QVariantList mValue;
2016  QList< QgsProcessingModelChildParameterSource > mModelSources;
2017  QgsProcessingModelAlgorithm *mModel = nullptr;
2018 
2019  QgsProject *mProject = nullptr;
2020 
2021  friend class TestProcessingGui;
2022 };
2023 
2024 class GUI_EXPORT QgsProcessingMultipleLayerParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
2025 {
2026  Q_OBJECT
2027  public:
2028 
2029  QgsProcessingMultipleLayerParameterDefinitionWidget( QgsProcessingContext &context,
2030  const QgsProcessingParameterWidgetContext &widgetContext,
2031  const QgsProcessingParameterDefinition *definition = nullptr,
2032  const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
2033  QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags ) const override;
2034 
2035  private:
2036 
2037  QComboBox *mLayerTypeComboBox = nullptr;
2038 };
2039 
2040 class GUI_EXPORT QgsProcessingMultipleLayerWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
2041 {
2042  Q_OBJECT
2043 
2044  public:
2045 
2046  QgsProcessingMultipleLayerWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2047  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2048 
2049  // QgsProcessingParameterWidgetFactoryInterface
2050  QString parameterType() const override;
2052  QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
2053  QgsProcessingContext &context,
2054  const QgsProcessingParameterWidgetContext &widgetContext,
2055  const QgsProcessingParameterDefinition *definition = nullptr,
2056  const QgsProcessingAlgorithm *algorithm = nullptr ) override;
2057 
2058  // QgsProcessingParameterWidgetWrapper interface
2059  QWidget *createWidget() override SIP_FACTORY;
2060  void setWidgetContext( const QgsProcessingParameterWidgetContext &context ) override;
2061 
2062  protected:
2063 
2064  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
2065  QVariant widgetValue() const override;
2066 
2067  QStringList compatibleParameterTypes() const override;
2068 
2069  QStringList compatibleOutputTypes() const override;
2070  QString modelerExpressionFormatString() const override;
2071 
2072  private:
2073 
2074  QgsProcessingMultipleLayerPanelWidget *mPanel = nullptr;
2075 
2076  friend class TestProcessingGui;
2077 };
2078 
2079 
2080 
2081 class GUI_EXPORT QgsProcessingOutputWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
2082 {
2083  Q_OBJECT
2084 
2085  public:
2086 
2087  QgsProcessingOutputWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2088  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2089 
2090  // QgsProcessingParameterWidgetWrapper interface
2091  QWidget *createWidget() override SIP_FACTORY;
2092  protected:
2093 
2094  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
2095  QVariant widgetValue() const override;
2096  QVariantMap customProperties() const override;
2097 
2098  QStringList compatibleParameterTypes() const override;
2099 
2100  QStringList compatibleOutputTypes() const override;
2101 
2102  private:
2103 
2104  QgsProcessingLayerOutputDestinationWidget *mOutputWidget = nullptr;
2105  int mBlockSignals = 0;
2106 
2107  friend class TestProcessingGui;
2108 };
2109 
2110 
2111 class GUI_EXPORT QgsProcessingFeatureSinkWidgetWrapper : public QgsProcessingOutputWidgetWrapper
2112 {
2113  Q_OBJECT
2114 
2115  public:
2116 
2117  QgsProcessingFeatureSinkWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2118  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2119 
2120  // QgsProcessingParameterWidgetFactoryInterface
2121  QString parameterType() const override;
2123 
2124  protected:
2125  QString modelerExpressionFormatString() const override;
2126 
2127  private:
2128  QgsProcessingContext mContext;
2129 
2130 };
2131 
2132 class GUI_EXPORT QgsProcessingVectorDestinationWidgetWrapper : public QgsProcessingOutputWidgetWrapper
2133 {
2134  Q_OBJECT
2135 
2136  public:
2137 
2138  QgsProcessingVectorDestinationWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2139  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2140 
2141  // QgsProcessingParameterWidgetFactoryInterface
2142  QString parameterType() const override;
2144 
2145  protected:
2146  QString modelerExpressionFormatString() const override;
2147 
2148 };
2149 
2150 class GUI_EXPORT QgsProcessingRasterDestinationWidgetWrapper : public QgsProcessingOutputWidgetWrapper
2151 {
2152  Q_OBJECT
2153 
2154  public:
2155 
2156  QgsProcessingRasterDestinationWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2157  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2158 
2159  // QgsProcessingParameterWidgetFactoryInterface
2160  QString parameterType() const override;
2162 
2163  protected:
2164  QString modelerExpressionFormatString() const override;
2165 
2166 };
2167 
2168 class GUI_EXPORT QgsProcessingFileDestinationWidgetWrapper : public QgsProcessingOutputWidgetWrapper
2169 {
2170  Q_OBJECT
2171 
2172  public:
2173 
2174  QgsProcessingFileDestinationWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2175  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2176 
2177  // QgsProcessingParameterWidgetFactoryInterface
2178  QString parameterType() const override;
2180 
2181  protected:
2182  QString modelerExpressionFormatString() const override;
2183 
2184 };
2185 
2186 class GUI_EXPORT QgsProcessingFolderDestinationWidgetWrapper : public QgsProcessingOutputWidgetWrapper
2187 {
2188  Q_OBJECT
2189 
2190  public:
2191 
2192  QgsProcessingFolderDestinationWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2193  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2194 
2195  // QgsProcessingParameterWidgetFactoryInterface
2196  QString parameterType() const override;
2198 
2199  protected:
2200  QString modelerExpressionFormatString() const override;
2201 
2202 };
2203 
2205 
2206 #endif // QGSPROCESSINGWIDGETWRAPPERIMPL_H
A widget wrapper for Processing parameter value widgets.
Selector widget for authentication configs.
QComboBox subclass which allows selecting multiple items.
A cross platform button subclass for selecting colors.
A widget for selecting the coordinate operation to use when transforming between a source and destina...
This class represents a coordinate reference system (CRS).
The QgsDatabaseSchemaComboBox class is a combo box which displays the list of schemas for a specific ...
The QgsDatabaseTableComboBox class is a combo box which displays the list of tables for a specific da...
The QgsDateEdit class is a QDateEdit widget with the capability of setting/reading null dates.
The QgsDateTimeEdit class is a QDateTimeEdit with the capability of setting/reading null date/times.
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value.
A reusable widget that can be used to build a expression string.
The QgsExpressionLineEdit widget includes a line edit for entering expressions together with a button...
A widget for configuration of a map extent.
The QgsFieldComboBox is a combo box which displays the list of fields of a given layer.
The QgsFieldExpressionWidget class reates a widget to choose fields and edit expressions It contains ...
Container of fields for a vector layer.
Definition: qgsfields.h:45
The QgsFileWidget class creates a widget for selecting a file or a folder.
Definition: qgsfilewidget.h:37
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
The QgsLayoutComboBox class is a combo box which displays available layouts from a QgsLayoutManager.
The QgsLayoutItemComboBox class is a combo box which displays items of a matching type from a layout.
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:86
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
Abstract base class for all map tools.
Definition: qgsmaptool.h:66
A class to represent a 2D point.
Definition: qgspointxy.h:59
Print layout, a QgsLayout subclass for static or atlas-based layouts.
Abstract base class for widgets which allow users to specify the properties of a Processing parameter...
virtual void setWidgetContext(const QgsProcessingParameterWidgetContext &context)
Sets the context in which the Processing definition widget is shown, e.g., the parent model algorithm...
virtual QgsProcessingParameterDefinition * createParameter(const QString &name, const QString &description, QgsProcessingParameterDefinition::Flags flags) const =0
Returns a new instance of a parameter definition, using the current settings defined in the dialog.
Abstract base class for processing algorithms.
An interface for objects which can create Processing contexts.
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.
A raster band parameter for Processing algorithms.
Base class for the definition of processing parameters.
An enum based parameter for processing algorithms, allowing for selection from predefined values.
A vector layer or feature source field parameter for processing algorithms.
A parameter for processing algorithms which accepts multiple map layers.
Contains settings which reflect the context in which a Processing parameter widget is shown,...
An interface for Processing widget wrapper factories.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition: qgsproject.h:99
A widget for selecting a projection.
The QgsProviderConnectionComboBox class is a combo box which displays the list of connections registe...
A combobox widget which displays the bands present in a raster layer.
Represents a raster layer.
A combobox which lets the user select map scale from predefined list and highlights nearest to curren...
Class that shows snapping marker on map canvas for the current snapping match.
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value.
Definition: qgsspinbox.h:43
The QgsTimeEdit class is a QTimeEdit widget with the capability of setting/reading null date/times.
Helper functions for various unit types.
Definition: qgsunittypes.h:39
Represents a vector layer which manages a vector based data sets.
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
Definition: qgsgeos.h:79
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
const QgsCoordinateReferenceSystem & crs