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