QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
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"
28#include "qgspointcloudlayer.h"
30#include "qobjectuniqueptr.h"
32#include <QAbstractButton>
33
34class QCheckBox;
35class QComboBox;
36class QLineEdit;
37class QPlainTextEdit;
38class QToolButton;
39class QButtonGroup;
41class QgsSpinBox;
44class QgsProcessingMatrixParameterPanel;
45class QgsFileWidget;
52class QgsPrintLayout;
53class QgsScaleWidget;
56class QgsColorButton;
59class QgsDateTimeEdit;
60class QgsDateEdit;
61class QgsTimeEdit;
65class QgsExtentWidget;
66class QgsProcessingEnumModelerWidget;
67class QgsProcessingMatrixModelerWidget;
68class QgsProcessingMapLayerComboBox;
71class QgsProcessingLayerOutputDestinationWidget;
74class QgsProcessingPointCloudExpressionLineEdit;
75class QgsProcessingRasterCalculatorExpressionLineEdit;
76class QgsRubberBand;
79
81
82class GUI_EXPORT QgsProcessingBooleanParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
83{
84 Q_OBJECT
85 public:
86
87 QgsProcessingBooleanParameterDefinitionWidget( QgsProcessingContext &context,
88 const QgsProcessingParameterWidgetContext &widgetContext,
89 const QgsProcessingParameterDefinition *definition = nullptr,
90 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
91 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
92
93 private:
94
95 QCheckBox *mDefaultCheckBox = nullptr;
96
97};
98
99class GUI_EXPORT QgsProcessingBooleanWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
100{
101 Q_OBJECT
102
103 public:
104
105 QgsProcessingBooleanWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
106 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
107
108 // QgsProcessingParameterWidgetFactoryInterface
109 QString parameterType() const override;
111 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
112 QgsProcessingContext &context,
113 const QgsProcessingParameterWidgetContext &widgetContext,
114 const QgsProcessingParameterDefinition *definition = nullptr,
115 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
116
117 // QgsProcessingParameterWidgetWrapper interface
118 QWidget *createWidget() override SIP_FACTORY;
119 QLabel *createLabel() override SIP_FACTORY;
120
121 protected:
122
123 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
124 QVariant widgetValue() const override;
125
126 QStringList compatibleParameterTypes() const override;
127
128 QStringList compatibleOutputTypes() const override;
129
130 private:
131
132 QCheckBox *mCheckBox = nullptr;
133 QComboBox *mComboBox = nullptr;
134
135 friend class TestProcessingGui;
136};
137
138
139
140class GUI_EXPORT QgsProcessingCrsParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
141{
142 Q_OBJECT
143 public:
144
145 QgsProcessingCrsParameterDefinitionWidget( QgsProcessingContext &context,
146 const QgsProcessingParameterWidgetContext &widgetContext,
147 const QgsProcessingParameterDefinition *definition = nullptr,
148 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
149 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
150
151 private:
152
153 QgsProjectionSelectionWidget *mCrsSelector = nullptr;
154};
155
156class GUI_EXPORT QgsProcessingCrsWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
157{
158 Q_OBJECT
159
160 public:
161
162 QgsProcessingCrsWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
163 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
164
165 // QgsProcessingParameterWidgetFactoryInterface
166 QString parameterType() const override;
168 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
169 QgsProcessingContext &context,
170 const QgsProcessingParameterWidgetContext &widgetContext,
171 const QgsProcessingParameterDefinition *definition = nullptr,
172 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
173
174 // QgsProcessingParameterWidgetWrapper interface
175 QWidget *createWidget() override SIP_FACTORY;
176
177 protected:
178
179 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
180 QVariant widgetValue() const override;
181
182 QStringList compatibleParameterTypes() const override;
183 QStringList compatibleOutputTypes() const override;
184 QString modelerExpressionFormatString() const override;
185
186 private:
187
188 QgsProjectionSelectionWidget *mProjectionSelectionWidget = nullptr;
189 QCheckBox *mUseProjectCrsCheckBox = nullptr;
190
191 friend class TestProcessingGui;
192};
193
194
195
196class GUI_EXPORT QgsProcessingStringParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
197{
198 Q_OBJECT
199 public:
200
201 QgsProcessingStringParameterDefinitionWidget( QgsProcessingContext &context,
202 const QgsProcessingParameterWidgetContext &widgetContext,
203 const QgsProcessingParameterDefinition *definition = nullptr,
204 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
205 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
206
207 private:
208
209 QLineEdit *mDefaultLineEdit = nullptr;
210 QCheckBox *mMultiLineCheckBox = nullptr;
211
212};
213
214class GUI_EXPORT QgsProcessingStringWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
215{
216 Q_OBJECT
217
218 public:
219
220 QgsProcessingStringWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
221 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
222
223 // QgsProcessingParameterWidgetFactoryInterface
224 QString parameterType() const override;
226 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
227 QgsProcessingContext &context,
228 const QgsProcessingParameterWidgetContext &widgetContext,
229 const QgsProcessingParameterDefinition *definition = nullptr,
230 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
231
232 // QgsProcessingParameterWidgetWrapper interface
233 QWidget *createWidget() override SIP_FACTORY;
234
235 protected:
236
237 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
238 QVariant widgetValue() const override;
239
240 QStringList compatibleParameterTypes() const override;
241
242 QStringList compatibleOutputTypes() const override;
243 private:
244
245 QLineEdit *mLineEdit = nullptr;
246 QComboBox *mComboBox = nullptr;
247 QPlainTextEdit *mPlainTextEdit = nullptr;
248
249 friend class TestProcessingGui;
250};
251
252
253class GUI_EXPORT QgsProcessingAuthConfigWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
254{
255 Q_OBJECT
256
257 public:
258
259 QgsProcessingAuthConfigWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
260 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
261
262 // QgsProcessingParameterWidgetFactoryInterface
263 QString parameterType() const override;
265
266 // QgsProcessingParameterWidgetWrapper interface
267 QWidget *createWidget() override SIP_FACTORY;
268
269 protected:
270
271 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
272 QVariant widgetValue() const override;
273
274 QStringList compatibleParameterTypes() const override;
275
276 QStringList compatibleOutputTypes() const override;
277 private:
278
279 QgsAuthConfigSelect *mAuthConfigSelect = nullptr;
280
281 friend class TestProcessingGui;
282};
283
284
285class GUI_EXPORT QgsProcessingNumberParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
286{
287 Q_OBJECT
288 public:
289
290 QgsProcessingNumberParameterDefinitionWidget( QgsProcessingContext &context,
291 const QgsProcessingParameterWidgetContext &widgetContext,
292 const QgsProcessingParameterDefinition *definition = nullptr,
293 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
294 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
295
296 private:
297
298 QComboBox *mTypeComboBox = nullptr;
299 QLineEdit *mMinLineEdit = nullptr;
300 QLineEdit *mMaxLineEdit = nullptr;
301 QLineEdit *mDefaultLineEdit = nullptr;
302
303};
304
305
306class GUI_EXPORT QgsProcessingNumericWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
307{
308 Q_OBJECT
309
310 public:
311
312 QgsProcessingNumericWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
313 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
314
315 // QgsProcessingParameterWidgetFactoryInterface
316 QString parameterType() const override;
318 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
319 QgsProcessingContext &context,
320 const QgsProcessingParameterWidgetContext &widgetContext,
321 const QgsProcessingParameterDefinition *definition = nullptr,
322 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
323
324 // QgsProcessingParameterWidgetWrapper interface
325 QWidget *createWidget() override SIP_FACTORY;
326
327 protected:
328
329 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
330 QVariant widgetValue() const override;
331
332 QStringList compatibleParameterTypes() const override;
333
334 QStringList compatibleOutputTypes() const override;
335
336 protected:
337
338 QgsSpinBox *mSpinBox = nullptr;
339 QgsDoubleSpinBox *mDoubleSpinBox = nullptr;
340
341 private:
342
343 static double calculateStep( double minimum, double maximum );
344
345 bool mAllowingNull = false;
346
347 friend class TestProcessingGui;
348};
349
350
351class GUI_EXPORT QgsProcessingDistanceParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
352{
353 Q_OBJECT
354 public:
355
356 QgsProcessingDistanceParameterDefinitionWidget( QgsProcessingContext &context,
357 const QgsProcessingParameterWidgetContext &widgetContext,
358 const QgsProcessingParameterDefinition *definition = nullptr,
359 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
360 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
361
362 private:
363
364 QComboBox *mParentLayerComboBox = nullptr;
365 QLineEdit *mMinLineEdit = nullptr;
366 QLineEdit *mMaxLineEdit = nullptr;
367 QLineEdit *mDefaultLineEdit = nullptr;
368
369};
370
371class GUI_EXPORT QgsProcessingDistanceWidgetWrapper : public QgsProcessingNumericWidgetWrapper
372{
373 Q_OBJECT
374
375 public:
376
377 QgsProcessingDistanceWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
378 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
379
380 // QgsProcessingParameterWidgetFactoryInterface
381 QString parameterType() const override;
383 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
384 QgsProcessingContext &context,
385 const QgsProcessingParameterWidgetContext &widgetContext,
386 const QgsProcessingParameterDefinition *definition = nullptr,
387 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
388
389 // QgsProcessingParameterWidgetWrapper interface
390 QWidget *createWidget() override SIP_FACTORY;
391 void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
392
393 public slots:
394 void setUnitParameterValue( const QVariant &value, const QgsAbstractProcessingParameterWidgetWrapper *unitParameterWrapper = nullptr );
395 void setUnits( Qgis::DistanceUnit unit );
396
397 protected:
398
399 QVariant widgetValue() const override;
400
401 private:
402
403 Qgis::DistanceUnit mBaseUnit = Qgis::DistanceUnit::Unknown;
404 QLabel *mLabel = nullptr;
405 QWidget *mWarningLabel = nullptr;
406 QComboBox *mUnitsCombo = nullptr;
407
408 friend class TestProcessingGui;
409};
410
411class GUI_EXPORT QgsProcessingAreaParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
412{
413 Q_OBJECT
414 public:
415
416 QgsProcessingAreaParameterDefinitionWidget( QgsProcessingContext &context,
417 const QgsProcessingParameterWidgetContext &widgetContext,
418 const QgsProcessingParameterDefinition *definition = nullptr,
419 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
420 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
421
422 private:
423
424 QComboBox *mParentLayerComboBox = nullptr;
425 QLineEdit *mMinLineEdit = nullptr;
426 QLineEdit *mMaxLineEdit = nullptr;
427 QLineEdit *mDefaultLineEdit = nullptr;
428
429};
430
431class GUI_EXPORT QgsProcessingAreaWidgetWrapper : public QgsProcessingNumericWidgetWrapper
432{
433 Q_OBJECT
434
435 public:
436
437 QgsProcessingAreaWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
438 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
439
440 // QgsProcessingParameterWidgetFactoryInterface
441 QString parameterType() const override;
443 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
444 QgsProcessingContext &context,
445 const QgsProcessingParameterWidgetContext &widgetContext,
446 const QgsProcessingParameterDefinition *definition = nullptr,
447 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
448
449 // QgsProcessingParameterWidgetWrapper interface
450 QWidget *createWidget() override SIP_FACTORY;
451 void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
452
453 public slots:
454 void setUnitParameterValue( const QVariant &value, const QgsAbstractProcessingParameterWidgetWrapper *unitParameterWrapper = nullptr );
455 void setUnits( Qgis::AreaUnit unit );
456
457 protected:
458
459 QVariant widgetValue() const override;
460
461 private:
462
463 Qgis::AreaUnit mBaseUnit = Qgis::AreaUnit::Unknown;
464 QLabel *mLabel = nullptr;
465 QWidget *mWarningLabel = nullptr;
466 QComboBox *mUnitsCombo = nullptr;
467
468 friend class TestProcessingGui;
469};
470
471
472class GUI_EXPORT QgsProcessingVolumeParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
473{
474 Q_OBJECT
475 public:
476
477 QgsProcessingVolumeParameterDefinitionWidget( QgsProcessingContext &context,
478 const QgsProcessingParameterWidgetContext &widgetContext,
479 const QgsProcessingParameterDefinition *definition = nullptr,
480 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
481 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
482
483 private:
484
485 QComboBox *mParentLayerComboBox = nullptr;
486 QLineEdit *mMinLineEdit = nullptr;
487 QLineEdit *mMaxLineEdit = nullptr;
488 QLineEdit *mDefaultLineEdit = nullptr;
489
490};
491
492class GUI_EXPORT QgsProcessingVolumeWidgetWrapper : public QgsProcessingNumericWidgetWrapper
493{
494 Q_OBJECT
495
496 public:
497
498 QgsProcessingVolumeWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
499 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
500
501 // QgsProcessingParameterWidgetFactoryInterface
502 QString parameterType() const override;
504 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
505 QgsProcessingContext &context,
506 const QgsProcessingParameterWidgetContext &widgetContext,
507 const QgsProcessingParameterDefinition *definition = nullptr,
508 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
509
510 // QgsProcessingParameterWidgetWrapper interface
511 QWidget *createWidget() override SIP_FACTORY;
512 void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
513
514 public slots:
515 void setUnitParameterValue( const QVariant &value, const QgsAbstractProcessingParameterWidgetWrapper *unitParameterWrapper = nullptr );
516 void setUnits( Qgis::VolumeUnit unit );
517
518 protected:
519
520 QVariant widgetValue() const override;
521
522 private:
523
524 Qgis::VolumeUnit mBaseUnit = Qgis::VolumeUnit::Unknown;
525 QLabel *mLabel = nullptr;
526 QWidget *mWarningLabel = nullptr;
527 QComboBox *mUnitsCombo = nullptr;
528
529 friend class TestProcessingGui;
530};
531
532
533class GUI_EXPORT QgsProcessingDurationParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
534{
535 Q_OBJECT
536 public:
537
538 QgsProcessingDurationParameterDefinitionWidget( QgsProcessingContext &context,
539 const QgsProcessingParameterWidgetContext &widgetContext,
540 const QgsProcessingParameterDefinition *definition = nullptr,
541 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
542 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
543
544 private:
545
546 QLineEdit *mMinLineEdit = nullptr;
547 QLineEdit *mMaxLineEdit = nullptr;
548 QLineEdit *mDefaultLineEdit = nullptr;
549 QComboBox *mUnitsCombo = nullptr;
550
551};
552
553class GUI_EXPORT QgsProcessingDurationWidgetWrapper : public QgsProcessingNumericWidgetWrapper
554{
555 Q_OBJECT
556
557 public:
558
559 QgsProcessingDurationWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
560 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
561
562 // QgsProcessingParameterWidgetFactoryInterface
563 QString parameterType() const override;
565 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
566 QgsProcessingContext &context,
567 const QgsProcessingParameterWidgetContext &widgetContext,
568 const QgsProcessingParameterDefinition *definition = nullptr,
569 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
570
571 // QgsProcessingParameterWidgetWrapper interface
572 QWidget *createWidget() override SIP_FACTORY;
573 QLabel *createLabel() override SIP_FACTORY;
574
575 protected:
576
577 QVariant widgetValue() const override;
578 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
579
580 private:
581
582 Qgis::TemporalUnit mBaseUnit = Qgis::TemporalUnit::Milliseconds;
583 QComboBox *mUnitsCombo = nullptr;
584
585 friend class TestProcessingGui;
586};
587
588class GUI_EXPORT QgsProcessingScaleParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
589{
590 Q_OBJECT
591 public:
592
593 QgsProcessingScaleParameterDefinitionWidget( QgsProcessingContext &context,
594 const QgsProcessingParameterWidgetContext &widgetContext,
595 const QgsProcessingParameterDefinition *definition = nullptr,
596 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
597 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
598
599 private:
600
601 QLineEdit *mDefaultLineEdit = nullptr;
602
603};
604
605class GUI_EXPORT QgsProcessingScaleWidgetWrapper : public QgsProcessingNumericWidgetWrapper
606{
607 Q_OBJECT
608
609 public:
610
611 QgsProcessingScaleWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
612 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
613
614 // QgsProcessingParameterWidgetFactoryInterface
615 QString parameterType() const override;
617 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
618 QgsProcessingContext &context,
619 const QgsProcessingParameterWidgetContext &widgetContext,
620 const QgsProcessingParameterDefinition *definition = nullptr,
621 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
622
623 // QgsProcessingParameterWidgetWrapper interface
624 QWidget *createWidget() override SIP_FACTORY;
625 void setWidgetContext( const QgsProcessingParameterWidgetContext &context ) override;
626 protected:
627
628 QVariant widgetValue() const override;
629 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
630
631 private:
632
633 QgsScaleWidget *mScaleWidget = nullptr;
634
635 friend class TestProcessingGui;
636};
637
638
639class GUI_EXPORT QgsProcessingRangeParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
640{
641 Q_OBJECT
642 public:
643
644 QgsProcessingRangeParameterDefinitionWidget( QgsProcessingContext &context,
645 const QgsProcessingParameterWidgetContext &widgetContext,
646 const QgsProcessingParameterDefinition *definition = nullptr,
647 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
648 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
649
650 private:
651
652 QComboBox *mTypeComboBox = nullptr;
653 QLineEdit *mMinLineEdit = nullptr;
654 QLineEdit *mMaxLineEdit = nullptr;
655
656};
657
658class GUI_EXPORT QgsProcessingRangeWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
659{
660 Q_OBJECT
661
662 public:
663
664 QgsProcessingRangeWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
665 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
666
667 // QgsProcessingParameterWidgetFactoryInterface
668 QString parameterType() const override;
670 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
671 QgsProcessingContext &context,
672 const QgsProcessingParameterWidgetContext &widgetContext,
673 const QgsProcessingParameterDefinition *definition = nullptr,
674 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
675
676 // QgsProcessingParameterWidgetWrapper interface
677 QWidget *createWidget() override SIP_FACTORY;
678
679 protected:
680
681 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
682 QVariant widgetValue() const override;
683 QStringList compatibleParameterTypes() const override;
684 QStringList compatibleOutputTypes() const override;
685 QString modelerExpressionFormatString() const override;
686
687 protected:
688
689 QgsDoubleSpinBox *mMinSpinBox = nullptr;
690 QgsDoubleSpinBox *mMaxSpinBox = nullptr;
691
692 private:
693
694 int mBlockChangedSignal = 0;
695 bool mAllowingNull = false;
696
697 friend class TestProcessingGui;
698};
699
700class GUI_EXPORT QgsProcessingMatrixParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
701{
702 Q_OBJECT
703 public:
704
705 QgsProcessingMatrixParameterDefinitionWidget( QgsProcessingContext &context,
706 const QgsProcessingParameterWidgetContext &widgetContext,
707 const QgsProcessingParameterDefinition *definition = nullptr,
708 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
709 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
710
711 private:
712
713 QgsProcessingMatrixModelerWidget *mMatrixWidget = nullptr;
714
715};
716
717class GUI_EXPORT QgsProcessingMatrixWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
718{
719 Q_OBJECT
720
721 public:
722
723 QgsProcessingMatrixWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
724 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
725
726 // QgsProcessingParameterWidgetFactoryInterface
727 QString parameterType() const override;
729 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
730 QgsProcessingContext &context,
731 const QgsProcessingParameterWidgetContext &widgetContext,
732 const QgsProcessingParameterDefinition *definition = nullptr,
733 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
734
735 // QgsProcessingParameterWidgetWrapper interface
736 QWidget *createWidget() override SIP_FACTORY;
737
738 protected:
739
740 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
741 QVariant widgetValue() const override;
742
743 QStringList compatibleParameterTypes() const override;
744 QStringList compatibleOutputTypes() const override;
745 QString modelerExpressionFormatString() const override;
746
747 private:
748
749 QgsProcessingMatrixParameterPanel *mMatrixWidget = nullptr;
750
751 friend class TestProcessingGui;
752};
753
754class GUI_EXPORT QgsProcessingFileParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
755{
756 Q_OBJECT
757 public:
758
759 QgsProcessingFileParameterDefinitionWidget( QgsProcessingContext &context,
760 const QgsProcessingParameterWidgetContext &widgetContext,
761 const QgsProcessingParameterDefinition *definition = nullptr,
762 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
763 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
764
765 private:
766
767 QComboBox *mTypeComboBox = nullptr;
768 QComboBox *mFilterComboBox = nullptr;
769 QgsFileWidget *mDefaultFileWidget = nullptr;
770
771};
772
773class GUI_EXPORT QgsProcessingFileWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
774{
775 Q_OBJECT
776
777 public:
778
779 QgsProcessingFileWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
780 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
781
782 // QgsProcessingParameterWidgetFactoryInterface
783 QString parameterType() const override;
785 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
786 QgsProcessingContext &context,
787 const QgsProcessingParameterWidgetContext &widgetContext,
788 const QgsProcessingParameterDefinition *definition = nullptr,
789 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
790
791 // QgsProcessingParameterWidgetWrapper interface
792 QWidget *createWidget() override SIP_FACTORY;
793
794 protected:
795
796 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
797 QVariant widgetValue() const override;
798
799 QStringList compatibleParameterTypes() const override;
800
801 QStringList compatibleOutputTypes() const override;
802 QString modelerExpressionFormatString() const override;
803
804 private:
805
806 QgsFileWidget *mFileWidget = nullptr;
807
808 friend class TestProcessingGui;
809};
810
811
812
813class GUI_EXPORT QgsProcessingExpressionParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
814{
815 Q_OBJECT
816 public:
817
818 QgsProcessingExpressionParameterDefinitionWidget( QgsProcessingContext &context,
819 const QgsProcessingParameterWidgetContext &widgetContext,
820 const QgsProcessingParameterDefinition *definition = nullptr,
821 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
822 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
823
824 private:
825
826 QComboBox *mParentLayerComboBox = nullptr;
827 QgsExpressionLineEdit *mDefaultQgisLineEdit = nullptr;
828 QgsProcessingPointCloudExpressionLineEdit *mDefaultPointCloudLineEdit = nullptr;
829 QgsProcessingRasterCalculatorExpressionLineEdit *mDefaultRasterCalculatorLineEdit = nullptr;
830 QComboBox *mExpressionTypeComboBox = nullptr;
831
832};
833
834class GUI_EXPORT QgsProcessingExpressionWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
835{
836 Q_OBJECT
837
838 public:
839
840 QgsProcessingExpressionWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
841 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
842
843 // QgsProcessingParameterWidgetFactoryInterface
844 QString parameterType() const override;
846 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
847 QgsProcessingContext &context,
848 const QgsProcessingParameterWidgetContext &widgetContext,
849 const QgsProcessingParameterDefinition *definition = nullptr,
850 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
851
852 // QgsProcessingParameterWidgetWrapper interface
853 QWidget *createWidget() override SIP_FACTORY;
854 void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
855 void registerProcessingContextGenerator( QgsProcessingContextGenerator *generator ) override;
856
857 public slots:
858 void setParentLayerWrapperValue( const QgsAbstractProcessingParameterWidgetWrapper *parentWrapper );
859 protected:
860
861 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
862 QVariant widgetValue() const override;
863
864 QStringList compatibleParameterTypes() const override;
865
866 QStringList compatibleOutputTypes() const override;
867
868 QString modelerExpressionFormatString() const override;
869 const QgsVectorLayer *linkedVectorLayer() const override;
870 private:
871
872 QgsFieldExpressionWidget *mFieldExpWidget = nullptr;
873 QgsExpressionBuilderWidget *mExpBuilderWidget = nullptr;
874 QgsExpressionLineEdit *mExpLineEdit = nullptr;
875 QgsProcessingPointCloudExpressionLineEdit *mPointCloudExpLineEdit = nullptr;
876 QgsProcessingRasterCalculatorExpressionLineEdit *mRasterCalculatorExpLineEdit = nullptr;
877 std::unique_ptr< QgsMapLayer > mParentLayer;
878
879 friend class TestProcessingGui;
880};
881
882
883class GUI_EXPORT QgsProcessingEnumCheckboxPanelWidget : public QWidget
884{
885 Q_OBJECT
886
887 public:
888
889 QgsProcessingEnumCheckboxPanelWidget( QWidget *parent = nullptr, const QgsProcessingParameterEnum *param = nullptr, int columns = 2 );
890 QVariant value() const;
891 void setValue( const QVariant &value );
892
893 signals:
894
895 void changed();
896
897 private slots:
898
899 void showPopupMenu();
900 void selectAll();
901 void deselectAll();
902
903 private:
904
905 const QgsProcessingParameterEnum *mParam = nullptr;
906 QMap< QVariant, QAbstractButton * > mButtons;
907 QButtonGroup *mButtonGroup = nullptr;
908 int mColumns = 2;
909 bool mBlockChangedSignal = false;
910
911 friend class TestProcessingGui;
912};
913
914class GUI_EXPORT QgsProcessingEnumPanelWidget : public QWidget
915{
916 Q_OBJECT
917
918 public:
919
920 QgsProcessingEnumPanelWidget( QWidget *parent = nullptr, const QgsProcessingParameterEnum *param = nullptr );
921 QVariant value() const { return mValue; }
922 void setValue( const QVariant &value );
923
924 signals:
925
926 void changed();
927
928 private slots:
929
930 void showDialog();
931
932 private:
933
934 void updateSummaryText();
935
936 const QgsProcessingParameterEnum *mParam = nullptr;
937 QLineEdit *mLineEdit = nullptr;
938 QToolButton *mToolButton = nullptr;
939
940 QVariantList mValue;
941
942 friend class TestProcessingGui;
943};
944
945class GUI_EXPORT QgsProcessingEnumParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
946{
947 Q_OBJECT
948 public:
949
950 QgsProcessingEnumParameterDefinitionWidget( QgsProcessingContext &context,
951 const QgsProcessingParameterWidgetContext &widgetContext,
952 const QgsProcessingParameterDefinition *definition = nullptr,
953 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
954 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
955
956 private:
957
958 QgsProcessingEnumModelerWidget *mEnumWidget = nullptr;
959
960};
961
962class GUI_EXPORT QgsProcessingEnumWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
963{
964 Q_OBJECT
965
966 public:
967
968 QgsProcessingEnumWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
969 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
970
971 // QgsProcessingParameterWidgetFactoryInterface
972 QString parameterType() const override;
974 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
975 QgsProcessingContext &context,
976 const QgsProcessingParameterWidgetContext &widgetContext,
977 const QgsProcessingParameterDefinition *definition = nullptr,
978 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
979
980 // QgsProcessingParameterWidgetWrapper interface
981 QWidget *createWidget() override SIP_FACTORY;
982
983 protected:
984
985 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
986 QVariant widgetValue() const override;
987
988 QStringList compatibleParameterTypes() const override;
989
990 QStringList compatibleOutputTypes() const override;
991
992 QString modelerExpressionFormatString() const override;
993 private:
994
995 QComboBox *mComboBox = nullptr;
996 QgsProcessingEnumPanelWidget *mPanel = nullptr;
997 QgsProcessingEnumCheckboxPanelWidget *mCheckboxPanel = nullptr;
998
999 friend class TestProcessingGui;
1000};
1001
1002
1003
1004class GUI_EXPORT QgsProcessingLayoutWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1005{
1006 Q_OBJECT
1007
1008 public:
1009
1010 QgsProcessingLayoutWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1011 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1012
1013 // QgsProcessingParameterWidgetFactoryInterface
1014 QString parameterType() const override;
1016
1017 // QgsProcessingParameterWidgetWrapper interface
1018 QWidget *createWidget() override SIP_FACTORY;
1019
1020 protected:
1021
1022 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1023 QVariant widgetValue() const override;
1024 void setWidgetContext( const QgsProcessingParameterWidgetContext &context ) override;
1025
1026 QStringList compatibleParameterTypes() const override;
1027
1028 QStringList compatibleOutputTypes() const override;
1029
1030 QString modelerExpressionFormatString() const override;
1031 private:
1032
1033 QgsLayoutComboBox *mComboBox = nullptr;
1034 QComboBox *mPlainComboBox = nullptr;
1035
1036 friend class TestProcessingGui;
1037};
1038
1039
1040
1041class GUI_EXPORT QgsProcessingLayoutItemParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1042{
1043 Q_OBJECT
1044 public:
1045
1046 QgsProcessingLayoutItemParameterDefinitionWidget( QgsProcessingContext &context,
1047 const QgsProcessingParameterWidgetContext &widgetContext,
1048 const QgsProcessingParameterDefinition *definition = nullptr,
1049 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1050 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
1051
1052 private:
1053
1054 QComboBox *mParentLayoutComboBox = nullptr;
1055
1056};
1057
1058class GUI_EXPORT QgsProcessingLayoutItemWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1059{
1060 Q_OBJECT
1061
1062 public:
1063
1064 QgsProcessingLayoutItemWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1065 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1066
1067 // QgsProcessingParameterWidgetFactoryInterface
1068 QString parameterType() const override;
1070 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1071 QgsProcessingContext &context,
1072 const QgsProcessingParameterWidgetContext &widgetContext,
1073 const QgsProcessingParameterDefinition *definition = nullptr,
1074 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1075
1076 // QgsProcessingParameterWidgetWrapper interface
1077 QWidget *createWidget() override SIP_FACTORY;
1078 void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
1079
1080
1081 public slots:
1082 void setLayoutParameterValue( const QVariant &value );
1083 void setLayout( QgsPrintLayout *layout );
1084
1085 protected:
1086
1087 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1088 QVariant widgetValue() const override;
1089
1090 QStringList compatibleParameterTypes() const override;
1091
1092 QStringList compatibleOutputTypes() const override;
1093 QString modelerExpressionFormatString() const override;
1094 private:
1095
1096 QgsLayoutItemComboBox *mComboBox = nullptr;
1097 QLineEdit *mLineEdit = nullptr;
1098
1099 friend class TestProcessingGui;
1100};
1101
1102class GUI_EXPORT QgsProcessingPointMapTool : public QgsMapTool
1103{
1104 Q_OBJECT
1105 public:
1106 QgsProcessingPointMapTool( QgsMapCanvas *canvas );
1107 ~QgsProcessingPointMapTool() override;
1108 void deactivate() override;
1109 void canvasMoveEvent( QgsMapMouseEvent *e ) override;
1110 void canvasPressEvent( QgsMapMouseEvent *e ) override;
1111 void keyPressEvent( QKeyEvent *e ) override;
1112
1113 signals:
1114
1115 void clicked( const QgsPointXY &point );
1116 void complete();
1117
1118 private:
1119
1120 std::unique_ptr<QgsSnapIndicator> mSnapIndicator;
1121 friend class TestProcessingGui;
1122};
1123
1124class GUI_EXPORT QgsProcessingPointPanel : public QWidget
1125{
1126 Q_OBJECT
1127
1128 public:
1129
1130 QgsProcessingPointPanel( QWidget *parent );
1131 void setMapCanvas( QgsMapCanvas *canvas );
1132 void setAllowNull( bool allowNull );
1133 void setShowPointOnCanvas( bool show );
1134 void setAllowSelectOnCanvas( bool allow );
1135
1136 QVariant value() const;
1137 void clear();
1138 void setValue( const QgsPointXY &point, const QgsCoordinateReferenceSystem &crs );
1139 void showEvent( QShowEvent *event ) override;
1140
1141 signals:
1142
1143 void toggleDialogVisibility( bool visible );
1144 void changed();
1145
1146 private slots:
1147
1148 void selectOnCanvas();
1149 void updatePoint( const QgsPointXY &point );
1150 void pointPicked();
1151 void textChanged( const QString &text );
1152
1153 private:
1154 void updateRubberBand();
1155
1156 QgsFilterLineEdit *mLineEdit = nullptr;
1157 bool mShowPointOnCanvas = false;
1158 bool mFirstShow = true;
1159 bool mAllowSelectOnCanvas = true;
1160 QToolButton *mButton = nullptr;
1161 QgsMapCanvas *mCanvas = nullptr;
1163 QPointer< QgsMapTool > mPrevTool;
1164 std::unique_ptr< QgsProcessingPointMapTool > mTool;
1165 QgsPointXY mPoint;
1166 QObjectUniquePtr<QgsRubberBand> mMapPointRubberBand;
1167 friend class TestProcessingGui;
1168};
1169
1170
1171class GUI_EXPORT QgsProcessingPointParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1172{
1173 Q_OBJECT
1174 public:
1175
1176 QgsProcessingPointParameterDefinitionWidget( QgsProcessingContext &context,
1177 const QgsProcessingParameterWidgetContext &widgetContext,
1178 const QgsProcessingParameterDefinition *definition = nullptr,
1179 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1180 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
1181
1182 private:
1183
1184 QLineEdit *mDefaultLineEdit = nullptr;
1185
1186};
1187
1188class GUI_EXPORT QgsProcessingPointWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1189{
1190 Q_OBJECT
1191
1192 public:
1193
1194 QgsProcessingPointWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1195 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1196
1197 // QgsProcessingParameterWidgetFactoryInterface
1198 QString parameterType() const override;
1200 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1201 QgsProcessingContext &context,
1202 const QgsProcessingParameterWidgetContext &widgetContext,
1203 const QgsProcessingParameterDefinition *definition = nullptr,
1204 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1205
1206 // QgsProcessingParameterWidgetWrapper interface
1207 QWidget *createWidget() override SIP_FACTORY;
1208 void setWidgetContext( const QgsProcessingParameterWidgetContext &context ) override;
1209 void setDialog( QDialog *dialog ) override;
1210
1211 protected:
1212
1213 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1214 QVariant widgetValue() const override;
1215
1216 QStringList compatibleParameterTypes() const override;
1217
1218 QStringList compatibleOutputTypes() const override;
1219 QString modelerExpressionFormatString() const override;
1220 private:
1221
1222 QgsProcessingPointPanel *mPanel = nullptr;
1223 QLineEdit *mLineEdit = nullptr;
1224 QDialog *mDialog = nullptr;
1225
1226 friend class TestProcessingGui;
1227};
1228
1229class GUI_EXPORT QgsProcessingGeometryParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1230{
1231 Q_OBJECT
1232 public:
1233
1234 QgsProcessingGeometryParameterDefinitionWidget( QgsProcessingContext &context,
1235 const QgsProcessingParameterWidgetContext &widgetContext,
1236 const QgsProcessingParameterDefinition *definition = nullptr,
1237 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1238 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
1239
1240 private:
1241
1242 QgsGeometryWidget *mGeometryWidget = nullptr;
1243
1244};
1245
1246class GUI_EXPORT QgsProcessingGeometryWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1247{
1248 Q_OBJECT
1249
1250 public:
1251
1252 QgsProcessingGeometryWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1253 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1254
1255 // QgsProcessingParameterWidgetFactoryInterface
1256 QString parameterType() const override;
1258 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1259 QgsProcessingContext &context,
1260 const QgsProcessingParameterWidgetContext &widgetContext,
1261 const QgsProcessingParameterDefinition *definition = nullptr,
1262 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1263
1264 // QgsProcessingParameterWidgetWrapper interface
1265 QWidget *createWidget() override SIP_FACTORY;
1266
1267 protected:
1268
1269 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1270 QVariant widgetValue() const override;
1271
1272 QStringList compatibleParameterTypes() const override;
1273
1274 QStringList compatibleOutputTypes() const override;
1275 QString modelerExpressionFormatString() const override;
1276 private:
1277
1278 QgsGeometryWidget *mGeometryWidget = nullptr;
1279
1280 friend class TestProcessingGui;
1281};
1282
1283class GUI_EXPORT QgsProcessingExtentParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1284{
1285 Q_OBJECT
1286 public:
1287
1288 QgsProcessingExtentParameterDefinitionWidget( QgsProcessingContext &context,
1289 const QgsProcessingParameterWidgetContext &widgetContext,
1290 const QgsProcessingParameterDefinition *definition = nullptr,
1291 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1292 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
1293
1294 private:
1295
1296 QgsExtentWidget *mDefaultWidget = nullptr;
1297
1298};
1299
1300class GUI_EXPORT QgsProcessingExtentWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1301{
1302 Q_OBJECT
1303
1304 public:
1305
1306 QgsProcessingExtentWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1307 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1308
1309 // QgsProcessingParameterWidgetFactoryInterface
1310 QString parameterType() const override;
1312 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1313 QgsProcessingContext &context,
1314 const QgsProcessingParameterWidgetContext &widgetContext,
1315 const QgsProcessingParameterDefinition *definition = nullptr,
1316 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1317
1318 // QgsProcessingParameterWidgetWrapper interface
1319 QWidget *createWidget() override SIP_FACTORY;
1320 void setWidgetContext( const QgsProcessingParameterWidgetContext &context ) override;
1321 void setDialog( QDialog *dialog ) override;
1322
1323 protected:
1324
1325 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1326 QVariant widgetValue() const override;
1327
1328 QStringList compatibleParameterTypes() const override;
1329
1330 QStringList compatibleOutputTypes() const override;
1331 QString modelerExpressionFormatString() const override;
1332 private:
1333
1334 QgsExtentWidget *mExtentWidget = nullptr;
1335 QDialog *mDialog = nullptr;
1336
1337 friend class TestProcessingGui;
1338};
1339
1340class GUI_EXPORT QgsProcessingColorParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1341{
1342 Q_OBJECT
1343 public:
1344
1345 QgsProcessingColorParameterDefinitionWidget( QgsProcessingContext &context,
1346 const QgsProcessingParameterWidgetContext &widgetContext,
1347 const QgsProcessingParameterDefinition *definition = nullptr,
1348 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1349 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
1350
1351 private:
1352
1353 QgsColorButton *mDefaultColorButton = nullptr;
1354 QCheckBox *mAllowOpacity = nullptr;
1355
1356};
1357
1358class GUI_EXPORT QgsProcessingColorWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1359{
1360 Q_OBJECT
1361
1362 public:
1363
1364 QgsProcessingColorWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1365 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1366
1367 // QgsProcessingParameterWidgetFactoryInterface
1368 QString parameterType() const override;
1370 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1371 QgsProcessingContext &context,
1372 const QgsProcessingParameterWidgetContext &widgetContext,
1373 const QgsProcessingParameterDefinition *definition = nullptr,
1374 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1375
1376 // QgsProcessingParameterWidgetWrapper interface
1377 QWidget *createWidget() override SIP_FACTORY;
1378
1379 protected:
1380
1381 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1382 QVariant widgetValue() const override;
1383
1384 QStringList compatibleParameterTypes() const override;
1385
1386 QStringList compatibleOutputTypes() const override;
1387 QString modelerExpressionFormatString() const override;
1388 private:
1389
1390 QgsColorButton *mColorButton = nullptr;
1391 friend class TestProcessingGui;
1392};
1393
1394
1395
1396class GUI_EXPORT QgsProcessingCoordinateOperationParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1397{
1398 Q_OBJECT
1399 public:
1400
1401 QgsProcessingCoordinateOperationParameterDefinitionWidget( QgsProcessingContext &context,
1402 const QgsProcessingParameterWidgetContext &widgetContext,
1403 const QgsProcessingParameterDefinition *definition = nullptr,
1404 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1405 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
1406
1407 private:
1408
1409 QLineEdit *mDefaultLineEdit = nullptr;
1410
1411 QComboBox *mSourceParamComboBox = nullptr;
1412 QComboBox *mDestParamComboBox = nullptr;
1413
1414 QgsProjectionSelectionWidget *mStaticSourceWidget = nullptr;
1415 QgsProjectionSelectionWidget *mStaticDestWidget = nullptr;
1416
1417
1418};
1419
1420class GUI_EXPORT QgsProcessingCoordinateOperationWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1421{
1422 Q_OBJECT
1423
1424 public:
1425
1426 QgsProcessingCoordinateOperationWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1427 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1428
1429 // QgsProcessingParameterWidgetFactoryInterface
1430 QString parameterType() const override;
1432 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1433 QgsProcessingContext &context,
1434 const QgsProcessingParameterWidgetContext &widgetContext,
1435 const QgsProcessingParameterDefinition *definition = nullptr,
1436 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1437
1438 // QgsProcessingParameterWidgetWrapper interface
1439 QWidget *createWidget() override SIP_FACTORY;
1440 void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
1441 void setWidgetContext( const QgsProcessingParameterWidgetContext &context ) override;
1442 protected:
1443
1444 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1445 QVariant widgetValue() const override;
1446
1447 QStringList compatibleParameterTypes() const override;
1448
1449 QStringList compatibleOutputTypes() const override;
1450 QString modelerExpressionFormatString() const override;
1451 private:
1452
1453 void setSourceCrsParameterValue( const QVariant &value );
1454 void setDestinationCrsParameterValue( const QVariant &value );
1455
1456 QgsCoordinateOperationWidget *mOperationWidget = nullptr;
1457 QgsMapCanvas *mCanvas = nullptr;
1458 QLineEdit *mLineEdit = nullptr;
1461 friend class TestProcessingGui;
1462};
1463
1464class GUI_EXPORT QgsProcessingFieldPanelWidget : public QWidget
1465{
1466 Q_OBJECT
1467
1468 public:
1469
1470 QgsProcessingFieldPanelWidget( QWidget *parent = nullptr, const QgsProcessingParameterField *param = nullptr );
1471
1472 void setFields( const QgsFields &fields );
1473
1474 QgsFields fields() const { return mFields; }
1475
1476 QVariant value() const { return mValue; }
1477 void setValue( const QVariant &value );
1478
1479 signals:
1480
1481 void changed();
1482
1483 private slots:
1484
1485 void showDialog();
1486
1487 private:
1488
1489 void updateSummaryText();
1490
1491 QgsFields mFields;
1492
1493 const QgsProcessingParameterField *mParam = nullptr;
1494 QLineEdit *mLineEdit = nullptr;
1495 QToolButton *mToolButton = nullptr;
1496
1497 QVariantList mValue;
1498
1499 friend class TestProcessingGui;
1500};
1501
1502class GUI_EXPORT QgsProcessingFieldParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1503{
1504 Q_OBJECT
1505 public:
1506
1507 QgsProcessingFieldParameterDefinitionWidget( QgsProcessingContext &context,
1508 const QgsProcessingParameterWidgetContext &widgetContext,
1509 const QgsProcessingParameterDefinition *definition = nullptr,
1510 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1511 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
1512
1513 private:
1514
1515 QComboBox *mParentLayerComboBox = nullptr;
1516 QComboBox *mDataTypeComboBox = nullptr;
1517 QLineEdit *mDefaultLineEdit = nullptr;
1518 QCheckBox *mAllowMultipleCheckBox = nullptr;
1519 QCheckBox *mDefaultToAllCheckBox = nullptr;
1520};
1521
1522class GUI_EXPORT QgsProcessingFieldWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1523{
1524 Q_OBJECT
1525
1526 public:
1527
1528 QgsProcessingFieldWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1529 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1530
1531 // QgsProcessingParameterWidgetFactoryInterface
1532 QString parameterType() const override;
1534 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1535 QgsProcessingContext &context,
1536 const QgsProcessingParameterWidgetContext &widgetContext,
1537 const QgsProcessingParameterDefinition *definition = nullptr,
1538 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1539
1540 // QgsProcessingParameterWidgetWrapper interface
1541 QWidget *createWidget() override SIP_FACTORY;
1542 void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
1543
1544 public slots:
1545 void setParentLayerWrapperValue( const QgsAbstractProcessingParameterWidgetWrapper *parentWrapper );
1546
1547 protected:
1548
1549 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1550 QVariant widgetValue() const override;
1551
1552 QStringList compatibleParameterTypes() const override;
1553
1554 QStringList compatibleOutputTypes() const override;
1555 QString modelerExpressionFormatString() const override;
1556 const QgsVectorLayer *linkedVectorLayer() const override;
1557
1558 private:
1559
1560 QgsFieldComboBox *mComboBox = nullptr;
1561 QgsProcessingFieldPanelWidget *mPanel = nullptr;
1562 QLineEdit *mLineEdit = nullptr;
1563
1564 std::unique_ptr< QgsVectorLayer > mParentLayer;
1565
1566 QgsFields filterFields( const QgsFields &fields ) const;
1567
1568 friend class TestProcessingGui;
1569};
1570
1571
1572class GUI_EXPORT QgsProcessingMapThemeParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1573{
1574 Q_OBJECT
1575 public:
1576
1577 QgsProcessingMapThemeParameterDefinitionWidget( QgsProcessingContext &context,
1578 const QgsProcessingParameterWidgetContext &widgetContext,
1579 const QgsProcessingParameterDefinition *definition = nullptr,
1580 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1581 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
1582
1583 private:
1584
1585 QComboBox *mDefaultComboBox = nullptr;
1586
1587};
1588
1589class GUI_EXPORT QgsProcessingMapThemeWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1590{
1591 Q_OBJECT
1592
1593 public:
1594
1595 QgsProcessingMapThemeWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1596 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1597
1598 // QgsProcessingParameterWidgetFactoryInterface
1599 QString parameterType() const override;
1601 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1602 QgsProcessingContext &context,
1603 const QgsProcessingParameterWidgetContext &widgetContext,
1604 const QgsProcessingParameterDefinition *definition = nullptr,
1605 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1606
1607 // QgsProcessingParameterWidgetWrapper interface
1608 QWidget *createWidget() override SIP_FACTORY;
1609
1610 protected:
1611
1612 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1613 QVariant widgetValue() const override;
1614
1615 QStringList compatibleParameterTypes() const override;
1616
1617 QStringList compatibleOutputTypes() const override;
1618 QString modelerExpressionFormatString() const override;
1619
1620 private:
1621
1622 QComboBox *mComboBox = nullptr;
1623
1624 friend class TestProcessingGui;
1625};
1626
1627
1628class GUI_EXPORT QgsProcessingDateTimeParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1629{
1630 Q_OBJECT
1631 public:
1632
1633 QgsProcessingDateTimeParameterDefinitionWidget( QgsProcessingContext &context,
1634 const QgsProcessingParameterWidgetContext &widgetContext,
1635 const QgsProcessingParameterDefinition *definition = nullptr,
1636 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1637 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
1638
1639 private:
1640
1641 QComboBox *mTypeComboBox = nullptr;
1642
1643};
1644
1645class GUI_EXPORT QgsProcessingDateTimeWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1646{
1647 Q_OBJECT
1648
1649 public:
1650
1651 QgsProcessingDateTimeWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1652 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1653
1654 // QgsProcessingParameterWidgetFactoryInterface
1655 QString parameterType() const override;
1657
1658 // QgsProcessingParameterWidgetWrapper interface
1659 QWidget *createWidget() override SIP_FACTORY;
1660 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1661 QgsProcessingContext &context,
1662 const QgsProcessingParameterWidgetContext &widgetContext,
1663 const QgsProcessingParameterDefinition *definition = nullptr,
1664 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1665
1666 protected:
1667
1668 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1669 QVariant widgetValue() const override;
1670
1671 QStringList compatibleParameterTypes() const override;
1672 QStringList compatibleOutputTypes() const override;
1673 QString modelerExpressionFormatString() const override;
1674
1675 private:
1676
1677 QgsDateTimeEdit *mDateTimeEdit = nullptr;
1678 QgsDateEdit *mDateEdit = nullptr;
1679 QgsTimeEdit *mTimeEdit = nullptr;
1680
1681 friend class TestProcessingGui;
1682};
1683
1684
1685
1686//
1687// QgsProcessingProviderConnectionWidgetWrapper
1688//
1689
1690class GUI_EXPORT QgsProcessingProviderConnectionParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1691{
1692 Q_OBJECT
1693 public:
1694
1695 QgsProcessingProviderConnectionParameterDefinitionWidget( QgsProcessingContext &context,
1696 const QgsProcessingParameterWidgetContext &widgetContext,
1697 const QgsProcessingParameterDefinition *definition = nullptr,
1698 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1699 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
1700
1701 private:
1702
1703 QComboBox *mProviderComboBox = nullptr;
1704 QLineEdit *mDefaultEdit = nullptr;
1705
1706};
1707
1708class GUI_EXPORT QgsProcessingProviderConnectionWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1709{
1710 Q_OBJECT
1711
1712 public:
1713
1714 QgsProcessingProviderConnectionWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1715 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1716
1717 // QgsProcessingParameterWidgetFactoryInterface
1718 QString parameterType() const override;
1720
1721
1722 // QgsProcessingParameterWidgetWrapper interface
1723 QWidget *createWidget() override SIP_FACTORY;
1724 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1725 QgsProcessingContext &context,
1726 const QgsProcessingParameterWidgetContext &widgetContext,
1727 const QgsProcessingParameterDefinition *definition = nullptr,
1728 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1729
1730 protected:
1731
1732 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1733 QVariant widgetValue() const override;
1734
1735 QStringList compatibleParameterTypes() const override;
1736
1737 QStringList compatibleOutputTypes() const override;
1738 QString modelerExpressionFormatString() const override;
1739
1740 private:
1741
1742 QgsProviderConnectionComboBox *mProviderComboBox = nullptr;
1743 int mBlockSignals = 0;
1744
1745 friend class TestProcessingGui;
1746};
1747
1748
1749
1750class GUI_EXPORT QgsProcessingDatabaseSchemaParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1751{
1752 Q_OBJECT
1753 public:
1754
1755 QgsProcessingDatabaseSchemaParameterDefinitionWidget( QgsProcessingContext &context,
1756 const QgsProcessingParameterWidgetContext &widgetContext,
1757 const QgsProcessingParameterDefinition *definition = nullptr,
1758 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1759 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
1760
1761 private:
1762
1763 QComboBox *mConnectionParamComboBox = nullptr;
1764 QLineEdit *mDefaultEdit = nullptr;
1765
1766};
1767
1768class GUI_EXPORT QgsProcessingDatabaseSchemaWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1769{
1770 Q_OBJECT
1771
1772 public:
1773
1774 QgsProcessingDatabaseSchemaWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1775 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1776
1777 // QgsProcessingParameterWidgetFactoryInterface
1778 QString parameterType() const override;
1780 void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
1781
1782
1783 // QgsProcessingParameterWidgetWrapper interface
1784 QWidget *createWidget() override SIP_FACTORY;
1785 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1786 QgsProcessingContext &context,
1787 const QgsProcessingParameterWidgetContext &widgetContext,
1788 const QgsProcessingParameterDefinition *definition = nullptr,
1789 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1790
1791 public slots:
1792 void setParentConnectionWrapperValue( const QgsAbstractProcessingParameterWidgetWrapper *parentWrapper );
1793
1794 protected:
1795
1796 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1797 QVariant widgetValue() const override;
1798
1799 QStringList compatibleParameterTypes() const override;
1800
1801 QStringList compatibleOutputTypes() const override;
1802 QString modelerExpressionFormatString() const override;
1803
1804 private:
1805
1806 QgsDatabaseSchemaComboBox *mSchemaComboBox = nullptr;
1807 int mBlockSignals = 0;
1808
1809 friend class TestProcessingGui;
1810};
1811
1812
1813
1814
1815class GUI_EXPORT QgsProcessingDatabaseTableParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1816{
1817 Q_OBJECT
1818 public:
1819
1820 QgsProcessingDatabaseTableParameterDefinitionWidget( QgsProcessingContext &context,
1821 const QgsProcessingParameterWidgetContext &widgetContext,
1822 const QgsProcessingParameterDefinition *definition = nullptr,
1823 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1824 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
1825
1826 private:
1827
1828 QComboBox *mConnectionParamComboBox = nullptr;
1829 QComboBox *mSchemaParamComboBox = nullptr;
1830 QLineEdit *mDefaultEdit = nullptr;
1831
1832};
1833
1834class GUI_EXPORT QgsProcessingDatabaseTableWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1835{
1836 Q_OBJECT
1837
1838 public:
1839
1840 QgsProcessingDatabaseTableWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1841 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1842
1843 // QgsProcessingParameterWidgetFactoryInterface
1844 QString parameterType() const override;
1846 void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
1847
1848
1849 // QgsProcessingParameterWidgetWrapper interface
1850 QWidget *createWidget() override SIP_FACTORY;
1851 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1852 QgsProcessingContext &context,
1853 const QgsProcessingParameterWidgetContext &widgetContext,
1854 const QgsProcessingParameterDefinition *definition = nullptr,
1855 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1856
1857 public slots:
1858 void setParentConnectionWrapperValue( const QgsAbstractProcessingParameterWidgetWrapper *parentWrapper );
1859 void setParentSchemaWrapperValue( const QgsAbstractProcessingParameterWidgetWrapper *parentWrapper );
1860
1861 protected:
1862
1863 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1864 QVariant widgetValue() const override;
1865
1866 QStringList compatibleParameterTypes() const override;
1867
1868 QStringList compatibleOutputTypes() const override;
1869 QString modelerExpressionFormatString() const override;
1870
1871 private:
1872
1873 QgsDatabaseTableComboBox *mTableComboBox = nullptr;
1874 int mBlockSignals = 0;
1875 QString mConnection;
1876 QString mProvider;
1877 QString mSchema;
1878
1879 friend class TestProcessingGui;
1880};
1881
1882class GUI_EXPORT QgsProcessingMapLayerParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1883{
1884 Q_OBJECT
1885 public:
1886
1887 QgsProcessingMapLayerParameterDefinitionWidget( QgsProcessingContext &context,
1888 const QgsProcessingParameterWidgetContext &widgetContext,
1889 const QgsProcessingParameterDefinition *definition = nullptr,
1890 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1891 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
1892
1893 private:
1894
1895 QgsCheckableComboBox *mLayerTypeComboBox = nullptr;
1896};
1897
1898class GUI_EXPORT QgsProcessingMapLayerWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
1899{
1900 Q_OBJECT
1901
1902 public:
1903
1904 QgsProcessingMapLayerWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1905 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1906
1907 // QgsProcessingParameterWidgetFactoryInterface
1908 QString parameterType() const override;
1910 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1911 QgsProcessingContext &context,
1912 const QgsProcessingParameterWidgetContext &widgetContext,
1913 const QgsProcessingParameterDefinition *definition = nullptr,
1914 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1915
1916 void setWidgetContext( const QgsProcessingParameterWidgetContext &context ) override;
1917 // QgsProcessingParameterWidgetWrapper interface
1918 QWidget *createWidget() override SIP_FACTORY;
1919 protected:
1920
1921 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
1922 QVariant widgetValue() const override;
1923
1924 QStringList compatibleParameterTypes() const override;
1925
1926 QStringList compatibleOutputTypes() const override;
1927 QString modelerExpressionFormatString() const override;
1928 Qgis::ProcessingModelChildParameterSource defaultModelSource( const QgsProcessingParameterDefinition *parameter ) const override;
1929
1930 private:
1931
1932 QPointer< QgsProcessingMapLayerComboBox > mComboBox;
1933 int mBlockSignals = 0;
1934
1935 friend class TestProcessingGui;
1936};
1937
1938
1939class GUI_EXPORT QgsProcessingRasterLayerWidgetWrapper : public QgsProcessingMapLayerWidgetWrapper
1940{
1941 Q_OBJECT
1942
1943 public:
1944
1945 QgsProcessingRasterLayerWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1946 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1947
1948 // QgsProcessingParameterWidgetFactoryInterface
1949 QString parameterType() const override;
1951 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1952 QgsProcessingContext &context,
1953 const QgsProcessingParameterWidgetContext &widgetContext,
1954 const QgsProcessingParameterDefinition *definition = nullptr,
1955 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
1956
1957 protected:
1958 QStringList compatibleParameterTypes() const override;
1959
1960 QStringList compatibleOutputTypes() const override;
1961
1962 QString modelerExpressionFormatString() const override;
1963
1964};
1965
1966
1967class GUI_EXPORT QgsProcessingVectorLayerParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
1968{
1969 Q_OBJECT
1970 public:
1971
1972 QgsProcessingVectorLayerParameterDefinitionWidget( QgsProcessingContext &context,
1973 const QgsProcessingParameterWidgetContext &widgetContext,
1974 const QgsProcessingParameterDefinition *definition = nullptr,
1975 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
1976 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
1977
1978 private:
1979
1980 QgsCheckableComboBox *mGeometryTypeComboBox = nullptr;
1981};
1982
1983class GUI_EXPORT QgsProcessingVectorLayerWidgetWrapper : public QgsProcessingMapLayerWidgetWrapper
1984{
1985 Q_OBJECT
1986
1987 public:
1988
1989 QgsProcessingVectorLayerWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
1990 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
1991
1992 // QgsProcessingParameterWidgetFactoryInterface
1993 QString parameterType() const override;
1995 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
1996 QgsProcessingContext &context,
1997 const QgsProcessingParameterWidgetContext &widgetContext,
1998 const QgsProcessingParameterDefinition *definition = nullptr,
1999 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
2000
2001 protected:
2002 QStringList compatibleParameterTypes() const override;
2003
2004 QStringList compatibleOutputTypes() const override;
2005
2006 QString modelerExpressionFormatString() const override;
2007 QList< int > compatibleDataTypes( const QgsProcessingParameterDefinition *parameter ) const override;
2008};
2009
2010
2011class GUI_EXPORT QgsProcessingFeatureSourceParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
2012{
2013 Q_OBJECT
2014 public:
2015
2016 QgsProcessingFeatureSourceParameterDefinitionWidget( QgsProcessingContext &context,
2017 const QgsProcessingParameterWidgetContext &widgetContext,
2018 const QgsProcessingParameterDefinition *definition = nullptr,
2019 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
2020 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
2021
2022 private:
2023
2024 QgsCheckableComboBox *mGeometryTypeComboBox = nullptr;
2025};
2026
2027class GUI_EXPORT QgsProcessingFeatureSourceWidgetWrapper : public QgsProcessingMapLayerWidgetWrapper
2028{
2029 Q_OBJECT
2030
2031 public:
2032
2033 QgsProcessingFeatureSourceWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2034 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2035
2036 // QgsProcessingParameterWidgetFactoryInterface
2037 QString parameterType() const override;
2039 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
2040 QgsProcessingContext &context,
2041 const QgsProcessingParameterWidgetContext &widgetContext,
2042 const QgsProcessingParameterDefinition *definition = nullptr,
2043 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
2044
2045 protected:
2046 QStringList compatibleParameterTypes() const override;
2047
2048 QStringList compatibleOutputTypes() const override;
2049
2050 QString modelerExpressionFormatString() const override;
2051 QList< int > compatibleDataTypes( const QgsProcessingParameterDefinition *parameter ) const override;
2052};
2053
2054
2055class GUI_EXPORT QgsProcessingMeshLayerWidgetWrapper : public QgsProcessingMapLayerWidgetWrapper
2056{
2057 Q_OBJECT
2058
2059 public:
2060
2061 QgsProcessingMeshLayerWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2062 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2063
2064 // QgsProcessingParameterWidgetFactoryInterface
2065 QString parameterType() const override;
2067 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
2068 QgsProcessingContext &context,
2069 const QgsProcessingParameterWidgetContext &widgetContext,
2070 const QgsProcessingParameterDefinition *definition = nullptr,
2071 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
2072
2073 protected:
2074 QStringList compatibleParameterTypes() const override;
2075
2076 QStringList compatibleOutputTypes() const override;
2077
2078 QString modelerExpressionFormatString() const override;
2079
2080};
2081
2082
2083class GUI_EXPORT QgsProcessingRasterBandPanelWidget : public QWidget
2084{
2085 Q_OBJECT
2086
2087 public:
2088
2089 QgsProcessingRasterBandPanelWidget( QWidget *parent = nullptr, const QgsProcessingParameterBand *param = nullptr );
2090
2091 void setBands( const QList< int > &bands );
2092 void setBandNames( const QHash<int, QString > &names );
2093 QList< int > bands() const { return mBands; }
2094
2095 QVariant value() const { return mValue; }
2096 void setValue( const QVariant &value );
2097
2098 signals:
2099
2100 void changed();
2101
2102 private slots:
2103
2104 void showDialog();
2105
2106 private:
2107
2108 void updateSummaryText();
2109
2110 QList< int > mBands;
2111 QHash<int, QString > mBandNames;
2112
2113 const QgsProcessingParameterBand *mParam = nullptr;
2114 QLineEdit *mLineEdit = nullptr;
2115 QToolButton *mToolButton = nullptr;
2116
2117 QVariantList mValue;
2118
2119 friend class TestProcessingGui;
2120};
2121
2122class GUI_EXPORT QgsProcessingBandParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
2123{
2124 Q_OBJECT
2125 public:
2126
2127 QgsProcessingBandParameterDefinitionWidget( QgsProcessingContext &context,
2128 const QgsProcessingParameterWidgetContext &widgetContext,
2129 const QgsProcessingParameterDefinition *definition = nullptr,
2130 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
2131 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
2132
2133 private:
2134
2135 QComboBox *mParentLayerComboBox = nullptr;
2136 QLineEdit *mDefaultLineEdit = nullptr;
2137 QCheckBox *mAllowMultipleCheckBox = nullptr;
2138};
2139
2140class GUI_EXPORT QgsProcessingBandWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
2141{
2142 Q_OBJECT
2143
2144 public:
2145
2146 QgsProcessingBandWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2147 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2148
2149 // QgsProcessingParameterWidgetFactoryInterface
2150 QString parameterType() const override;
2152 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
2153 QgsProcessingContext &context,
2154 const QgsProcessingParameterWidgetContext &widgetContext,
2155 const QgsProcessingParameterDefinition *definition = nullptr,
2156 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
2157
2158 // QgsProcessingParameterWidgetWrapper interface
2159 QWidget *createWidget() override SIP_FACTORY;
2160 void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
2161
2162 public slots:
2163 void setParentLayerWrapperValue( const QgsAbstractProcessingParameterWidgetWrapper *parentWrapper );
2164
2165 protected:
2166
2167 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
2168 QVariant widgetValue() const override;
2169
2170 QStringList compatibleParameterTypes() const override;
2171
2172 QStringList compatibleOutputTypes() const override;
2173 QString modelerExpressionFormatString() const override;
2174
2175 private:
2176
2177 QgsRasterBandComboBox *mComboBox = nullptr;
2178 QgsProcessingRasterBandPanelWidget *mPanel = nullptr;
2179 QLineEdit *mLineEdit = nullptr;
2180
2181 std::unique_ptr< QgsRasterLayer > mParentLayer;
2182
2183 friend class TestProcessingGui;
2184};
2185
2186
2187class GUI_EXPORT QgsProcessingMultipleLayerLineEdit: public QgsHighlightableLineEdit
2188{
2189 Q_OBJECT
2190
2191 public:
2192 QgsProcessingMultipleLayerLineEdit( QWidget *parent = nullptr, const QgsProcessingParameterMultipleLayers *param = nullptr );
2193 void dragEnterEvent( QDragEnterEvent *event ) override;
2194 void dragLeaveEvent( QDragLeaveEvent *event ) override;
2195 void dropEvent( QDropEvent *event ) override;
2196
2197 signals:
2198
2199 void layersDropped( const QVariantList &value );
2200
2201 private:
2202 const QgsProcessingParameterMultipleLayers *mParam = nullptr;
2203};
2204
2205class GUI_EXPORT QgsProcessingMultipleLayerPanelWidget : public QWidget
2206{
2207 Q_OBJECT
2208
2209 public:
2210
2211 QgsProcessingMultipleLayerPanelWidget( QWidget *parent = nullptr, const QgsProcessingParameterMultipleLayers *param = nullptr );
2212
2213 QVariant value() const { return mValue; }
2214 void setValue( const QVariant &value );
2215
2216 void setProject( QgsProject *project );
2217 void setModel( QgsProcessingModelAlgorithm *model, const QString &modelChildAlgorithmID );
2218
2219 signals:
2220
2221 void changed();
2222
2223 private slots:
2224
2225 void showDialog();
2226
2227 private:
2228
2229 void updateSummaryText();
2230
2231 const QgsProcessingParameterMultipleLayers *mParam = nullptr;
2232 QgsProcessingMultipleLayerLineEdit *mLineEdit = nullptr;
2233 QToolButton *mToolButton = nullptr;
2234
2235 QVariantList mValue;
2236 QList< QgsProcessingModelChildParameterSource > mModelSources;
2237 QgsProcessingModelAlgorithm *mModel = nullptr;
2238
2239 QgsProject *mProject = nullptr;
2240
2241 friend class TestProcessingGui;
2242};
2243
2244class GUI_EXPORT QgsProcessingMultipleLayerParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
2245{
2246 Q_OBJECT
2247 public:
2248
2249 QgsProcessingMultipleLayerParameterDefinitionWidget( QgsProcessingContext &context,
2250 const QgsProcessingParameterWidgetContext &widgetContext,
2251 const QgsProcessingParameterDefinition *definition = nullptr,
2252 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
2253 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
2254
2255 private:
2256
2257 QComboBox *mLayerTypeComboBox = nullptr;
2258};
2259
2260class GUI_EXPORT QgsProcessingMultipleLayerWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
2261{
2262 Q_OBJECT
2263
2264 public:
2265
2266 QgsProcessingMultipleLayerWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2267 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2268
2269 // QgsProcessingParameterWidgetFactoryInterface
2270 QString parameterType() const override;
2272 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
2273 QgsProcessingContext &context,
2274 const QgsProcessingParameterWidgetContext &widgetContext,
2275 const QgsProcessingParameterDefinition *definition = nullptr,
2276 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
2277
2278 // QgsProcessingParameterWidgetWrapper interface
2279 QWidget *createWidget() override SIP_FACTORY;
2280 void setWidgetContext( const QgsProcessingParameterWidgetContext &context ) override;
2281
2282 protected:
2283
2284 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
2285 QVariant widgetValue() const override;
2286
2287 QStringList compatibleParameterTypes() const override;
2288
2289 QStringList compatibleOutputTypes() const override;
2290 QString modelerExpressionFormatString() const override;
2291
2292 private:
2293
2294 QgsProcessingMultipleLayerPanelWidget *mPanel = nullptr;
2295
2296 friend class TestProcessingGui;
2297};
2298
2299
2300
2301class GUI_EXPORT QgsProcessingOutputWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
2302{
2303 Q_OBJECT
2304
2305 public:
2306
2307 QgsProcessingOutputWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2308 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2309
2310 // QgsProcessingParameterWidgetWrapper interface
2311 QWidget *createWidget() override SIP_FACTORY;
2312 protected:
2313
2314 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
2315 QVariant widgetValue() const override;
2316 QVariantMap customProperties() const override;
2317
2318 QStringList compatibleParameterTypes() const override;
2319
2320 QStringList compatibleOutputTypes() const override;
2321
2322 private:
2323
2324 QgsProcessingLayerOutputDestinationWidget *mOutputWidget = nullptr;
2325 int mBlockSignals = 0;
2326
2327 friend class TestProcessingGui;
2328};
2329
2330
2331class GUI_EXPORT QgsProcessingFeatureSinkWidgetWrapper : public QgsProcessingOutputWidgetWrapper
2332{
2333 Q_OBJECT
2334
2335 public:
2336
2337 QgsProcessingFeatureSinkWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2338 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2339
2340 // QgsProcessingParameterWidgetFactoryInterface
2341 QString parameterType() const override;
2343
2344 protected:
2345 QString modelerExpressionFormatString() const override;
2346
2347 private:
2348 QgsProcessingContext mContext;
2349
2350};
2351
2352class GUI_EXPORT QgsProcessingVectorDestinationWidgetWrapper : public QgsProcessingOutputWidgetWrapper
2353{
2354 Q_OBJECT
2355
2356 public:
2357
2358 QgsProcessingVectorDestinationWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2359 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2360
2361 // QgsProcessingParameterWidgetFactoryInterface
2362 QString parameterType() const override;
2364
2365 protected:
2366 QString modelerExpressionFormatString() const override;
2367
2368};
2369
2370class GUI_EXPORT QgsProcessingRasterDestinationWidgetWrapper : public QgsProcessingOutputWidgetWrapper
2371{
2372 Q_OBJECT
2373
2374 public:
2375
2376 QgsProcessingRasterDestinationWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2377 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2378
2379 // QgsProcessingParameterWidgetFactoryInterface
2380 QString parameterType() const override;
2382
2383 protected:
2384 QString modelerExpressionFormatString() const override;
2385
2386};
2387
2388class GUI_EXPORT QgsProcessingPointCloudDestinationWidgetWrapper : public QgsProcessingOutputWidgetWrapper
2389{
2390 Q_OBJECT
2391
2392 public:
2393
2394 QgsProcessingPointCloudDestinationWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2395 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2396
2397 // QgsProcessingParameterWidgetFactoryInterface
2398 QString parameterType() const override;
2400
2401 protected:
2402 QString modelerExpressionFormatString() const override;
2403
2404};
2405
2406class GUI_EXPORT QgsProcessingFileDestinationWidgetWrapper : public QgsProcessingOutputWidgetWrapper
2407{
2408 Q_OBJECT
2409
2410 public:
2411
2412 QgsProcessingFileDestinationWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2413 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2414
2415 // QgsProcessingParameterWidgetFactoryInterface
2416 QString parameterType() const override;
2418
2419 protected:
2420 QStringList compatibleParameterTypes() const override;
2421 QStringList compatibleOutputTypes() const override;
2422 QString modelerExpressionFormatString() const override;
2423
2424};
2425
2426class GUI_EXPORT QgsProcessingFolderDestinationWidgetWrapper : public QgsProcessingOutputWidgetWrapper
2427{
2428 Q_OBJECT
2429
2430 public:
2431
2432 QgsProcessingFolderDestinationWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2433 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2434
2435 // QgsProcessingParameterWidgetFactoryInterface
2436 QString parameterType() const override;
2438
2439 protected:
2440 QStringList compatibleParameterTypes() const override;
2441 QStringList compatibleOutputTypes() const override;
2442 QString modelerExpressionFormatString() const override;
2443
2444};
2445
2446class GUI_EXPORT QgsProcessingPointCloudLayerWidgetWrapper : public QgsProcessingMapLayerWidgetWrapper
2447{
2448 Q_OBJECT
2449
2450 public:
2451
2452 QgsProcessingPointCloudLayerWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2453 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2454
2455 // QgsProcessingParameterWidgetFactoryInterface
2456 QString parameterType() const override;
2458 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
2459 QgsProcessingContext &context,
2460 const QgsProcessingParameterWidgetContext &widgetContext,
2461 const QgsProcessingParameterDefinition *definition = nullptr,
2462 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
2463
2464 protected:
2465 QStringList compatibleParameterTypes() const override;
2466
2467 QStringList compatibleOutputTypes() const override;
2468
2469 QString modelerExpressionFormatString() const override;
2470
2471};
2472
2473
2474class GUI_EXPORT QgsProcessingAnnotationLayerWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
2475{
2476 Q_OBJECT
2477
2478 public:
2479
2480 QgsProcessingAnnotationLayerWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2481 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2482
2483 // QgsProcessingParameterWidgetFactoryInterface
2484 QString parameterType() const override;
2486 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
2487 QgsProcessingContext &context,
2488 const QgsProcessingParameterWidgetContext &widgetContext,
2489 const QgsProcessingParameterDefinition *definition = nullptr,
2490 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
2491 void setWidgetContext( const QgsProcessingParameterWidgetContext &context ) override;
2492
2493 QWidget *createWidget() override SIP_FACTORY;
2494 protected:
2495
2496 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
2497 QVariant widgetValue() const override;
2498
2499 QStringList compatibleParameterTypes() const override;
2500
2501 QStringList compatibleOutputTypes() const override;
2502
2503 QString modelerExpressionFormatString() const override;
2504
2505 private:
2506
2507 QPointer< QgsMapLayerComboBox > mComboBox;
2508 int mBlockSignals = 0;
2509
2510 friend class TestProcessingGui;
2511};
2512
2513
2514class GUI_EXPORT QgsProcessingPointCloudAttributePanelWidget : public QWidget
2515{
2516 Q_OBJECT
2517
2518 public:
2519
2520 QgsProcessingPointCloudAttributePanelWidget( QWidget *parent = nullptr, const QgsProcessingParameterPointCloudAttribute *param = nullptr );
2521
2522 void setAttributes( const QgsPointCloudAttributeCollection &attributes );
2523
2524 QgsPointCloudAttributeCollection attributes() const { return mAttributes; }
2525
2526 QVariant value() const { return mValue; }
2527 void setValue( const QVariant &value );
2528
2529 signals:
2530
2531 void changed();
2532
2533 private slots:
2534
2535 void showDialog();
2536
2537 private:
2538
2539 void updateSummaryText();
2540
2542
2543 const QgsProcessingParameterPointCloudAttribute *mParam = nullptr;
2544 QLineEdit *mLineEdit = nullptr;
2545 QToolButton *mToolButton = nullptr;
2546
2547 QVariantList mValue;
2548
2549 friend class TestProcessingGui;
2550};
2551
2552class GUI_EXPORT QgsProcessingPointCloudAttributeParameterDefinitionWidget : public QgsProcessingAbstractParameterDefinitionWidget
2553{
2554 Q_OBJECT
2555 public:
2556
2557 QgsProcessingPointCloudAttributeParameterDefinitionWidget( QgsProcessingContext &context,
2558 const QgsProcessingParameterWidgetContext &widgetContext,
2559 const QgsProcessingParameterDefinition *definition = nullptr,
2560 const QgsProcessingAlgorithm *algorithm = nullptr, QWidget *parent SIP_TRANSFERTHIS = nullptr );
2561 QgsProcessingParameterDefinition *createParameter( const QString &name, const QString &description, Qgis::ProcessingParameterFlags flags ) const override;
2562
2563 private:
2564
2565 QComboBox *mParentLayerComboBox = nullptr;
2566 QLineEdit *mDefaultLineEdit = nullptr;
2567 QCheckBox *mAllowMultipleCheckBox = nullptr;
2568 QCheckBox *mDefaultToAllCheckBox = nullptr;
2569};
2570
2571class GUI_EXPORT QgsProcessingPointCloudAttributeWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
2572{
2573 Q_OBJECT
2574
2575 public:
2576
2577 QgsProcessingPointCloudAttributeWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2578 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2579
2580 // QgsProcessingParameterWidgetFactoryInterface
2581 QString parameterType() const override;
2583 QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
2584 QgsProcessingContext &context,
2585 const QgsProcessingParameterWidgetContext &widgetContext,
2586 const QgsProcessingParameterDefinition *definition = nullptr,
2587 const QgsProcessingAlgorithm *algorithm = nullptr ) override;
2588
2589 // QgsProcessingParameterWidgetWrapper interface
2590 QWidget *createWidget() override SIP_FACTORY;
2591 void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
2592
2593 public slots:
2594 void setParentLayerWrapperValue( const QgsAbstractProcessingParameterWidgetWrapper *parentWrapper );
2595
2596 protected:
2597
2598 void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
2599 QVariant widgetValue() const override;
2600
2601 QStringList compatibleParameterTypes() const override;
2602
2603 QStringList compatibleOutputTypes() const override;
2604 QString modelerExpressionFormatString() const override;
2605
2606 private:
2607
2608 QgsPointCloudAttributeComboBox *mComboBox = nullptr;
2609 QgsProcessingPointCloudAttributePanelWidget *mPanel = nullptr;
2610 QLineEdit *mLineEdit = nullptr;
2611
2612 std::unique_ptr< QgsPointCloudLayer > mParentLayer;
2613
2614 friend class TestProcessingGui;
2615};
2616
2617class GUI_EXPORT QgsProcessingVectorTileDestinationWidgetWrapper : public QgsProcessingOutputWidgetWrapper
2618{
2619 Q_OBJECT
2620
2621 public:
2622
2623 QgsProcessingVectorTileDestinationWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
2624 QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
2625
2626 // QgsProcessingParameterWidgetFactoryInterface
2627 QString parameterType() const override;
2629
2630 protected:
2631 QString modelerExpressionFormatString() const override;
2632
2633};
2634
2636
2637#endif // QGSPROCESSINGWIDGETWRAPPERIMPL_H
Keeps a pointer to a QObject and deletes it whenever this object is deleted.
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
QFlags< ProcessingParameterFlag > ProcessingParameterFlags
Flags which dictate the behavior of Processing parameters.
Definition qgis.h:3499
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 creates a widget to choose fields and edit expressions It contains...
Container of fields for a vector layer.
Definition qgsfields.h:46
The QgsFileWidget class creates a widget for selecting a file or a folder.
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
A widget for storing and interacting with a QgsGeometry object.
A QgsFilterLineEdit subclass with the ability to "highlight" the edges of the widget.
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.
The QgsMapLayerComboBox class is a combo box which displays the list of layers.
Base class for all map layer types.
Definition qgsmaplayer.h:76
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:71
Collection of point cloud attributes.
The QgsPointCloudAttributeComboBox is a combo box which displays the list of attributes of a given po...
Represents a map layer supporting display of point clouds.
A class to represent a 2D point.
Definition qgspointxy.h:60
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, Qgis::ProcessingParameterFlags 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.
A point cloud layer attribute parameter for Processing algorithms.
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:107
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 class for drawing transient features (e.g.
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.
Represents a vector layer which manages a vector based data sets.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_FACTORY
Definition qgis_sip.h:76
const QgsCoordinateReferenceSystem & crs