QGIS API Documentation  3.8.0-Zanzibar (11aff65)
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
24 #include "qgsmaptool.h"
25 
26 #include <QAbstractButton>
27 
28 class QCheckBox;
29 class QComboBox;
30 class QLineEdit;
31 class QPlainTextEdit;
32 class QToolButton;
33 class QButtonGroup;
35 class QgsSpinBox;
36 class QgsDoubleSpinBox;
38 class QgsProcessingMatrixParameterPanel;
39 class QgsFileWidget;
43 class QgsLayoutComboBox;
45 class QgsPrintLayout;
46 class QgsScaleWidget;
47 class QgsSnapIndicator;
48 class QgsFilterLineEdit;
49 
51 
52 class GUI_EXPORT QgsProcessingBooleanWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
53 {
54  Q_OBJECT
55 
56  public:
57 
58  QgsProcessingBooleanWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
59  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
60 
61  // QgsProcessingParameterWidgetFactoryInterface
62  QString parameterType() const override;
64 
65  // QgsProcessingParameterWidgetWrapper interface
66  QWidget *createWidget() override SIP_FACTORY;
67  QLabel *createLabel() override SIP_FACTORY;
68 
69  protected:
70 
71  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
72  QVariant widgetValue() const override;
73 
74  QStringList compatibleParameterTypes() const override;
75 
76  QStringList compatibleOutputTypes() const override;
77 
78  QList< int > compatibleDataTypes() const override;
79 
80  private:
81 
82  QCheckBox *mCheckBox = nullptr;
83  QComboBox *mComboBox = nullptr;
84 
85  friend class TestProcessingGui;
86 };
87 
88 class GUI_EXPORT QgsProcessingCrsWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
89 {
90  Q_OBJECT
91 
92  public:
93 
94  QgsProcessingCrsWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
95  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
96 
97  // QgsProcessingParameterWidgetFactoryInterface
98  QString parameterType() const override;
99  QgsAbstractProcessingParameterWidgetWrapper *createWidgetWrapper( const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type ) override;
100 
101  // QgsProcessingParameterWidgetWrapper interface
102  QWidget *createWidget() override SIP_FACTORY;
103 
104  protected:
105 
106  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
107  QVariant widgetValue() const override;
108 
109  QStringList compatibleParameterTypes() const override;
110  QStringList compatibleOutputTypes() const override;
111  QList< int > compatibleDataTypes() const override;
112  QString modelerExpressionFormatString() const override;
113 
114  private:
115 
116  QgsProjectionSelectionWidget *mProjectionSelectionWidget = nullptr;
117  QCheckBox *mUseProjectCrsCheckBox = nullptr;
118 
119  friend class TestProcessingGui;
120 };
121 
122 class GUI_EXPORT QgsProcessingStringWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
123 {
124  Q_OBJECT
125 
126  public:
127 
128  QgsProcessingStringWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
129  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
130 
131  // QgsProcessingParameterWidgetFactoryInterface
132  QString parameterType() const override;
133  QgsAbstractProcessingParameterWidgetWrapper *createWidgetWrapper( const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type ) override;
134 
135  // QgsProcessingParameterWidgetWrapper interface
136  QWidget *createWidget() override SIP_FACTORY;
137 
138  protected:
139 
140  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
141  QVariant widgetValue() const override;
142 
143  QStringList compatibleParameterTypes() const override;
144 
145  QStringList compatibleOutputTypes() const override;
146 
147  QList< int > compatibleDataTypes() const override;
148 
149  private:
150 
151  QLineEdit *mLineEdit = nullptr;
152  QPlainTextEdit *mPlainTextEdit = nullptr;
153 
154  friend class TestProcessingGui;
155 };
156 
157 
158 class GUI_EXPORT QgsProcessingAuthConfigWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
159 {
160  Q_OBJECT
161 
162  public:
163 
164  QgsProcessingAuthConfigWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
165  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
166 
167  // QgsProcessingParameterWidgetFactoryInterface
168  QString parameterType() const override;
169  QgsAbstractProcessingParameterWidgetWrapper *createWidgetWrapper( const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type ) override;
170 
171  // QgsProcessingParameterWidgetWrapper interface
172  QWidget *createWidget() override SIP_FACTORY;
173 
174  protected:
175 
176  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
177  QVariant widgetValue() const override;
178 
179  QStringList compatibleParameterTypes() const override;
180 
181  QStringList compatibleOutputTypes() const override;
182 
183  QList< int > compatibleDataTypes() const override;
184 
185  private:
186 
187  QgsAuthConfigSelect *mAuthConfigSelect = nullptr;
188 
189  friend class TestProcessingGui;
190 };
191 
192 
193 class GUI_EXPORT QgsProcessingNumericWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
194 {
195  Q_OBJECT
196 
197  public:
198 
199  QgsProcessingNumericWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
200  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
201 
202  // QgsProcessingParameterWidgetFactoryInterface
203  QString parameterType() const override;
204  QgsAbstractProcessingParameterWidgetWrapper *createWidgetWrapper( const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type ) override;
205 
206  // QgsProcessingParameterWidgetWrapper interface
207  QWidget *createWidget() override SIP_FACTORY;
208 
209  protected:
210 
211  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
212  QVariant widgetValue() const override;
213 
214  QStringList compatibleParameterTypes() const override;
215 
216  QStringList compatibleOutputTypes() const override;
217 
218  QList< int > compatibleDataTypes() const override;
219 
220  protected:
221 
222  QgsSpinBox *mSpinBox = nullptr;
223  QgsDoubleSpinBox *mDoubleSpinBox = nullptr;
224 
225  private:
226 
227  static double calculateStep( double minimum, double maximum );
228 
229  bool mAllowingNull = false;
230 
231  friend class TestProcessingGui;
232 };
233 
234 
235 class GUI_EXPORT QgsProcessingDistanceWidgetWrapper : public QgsProcessingNumericWidgetWrapper
236 {
237  Q_OBJECT
238 
239  public:
240 
241  QgsProcessingDistanceWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
242  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
243 
244  // QgsProcessingParameterWidgetFactoryInterface
245  QString parameterType() const override;
246  QgsAbstractProcessingParameterWidgetWrapper *createWidgetWrapper( const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type ) override;
247 
248  // QgsProcessingParameterWidgetWrapper interface
249  QWidget *createWidget() override SIP_FACTORY;
250  void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
251 
252  public slots:
253  void setUnitParameterValue( const QVariant &value );
254  void setUnits( QgsUnitTypes::DistanceUnit unit );
255 
256  protected:
257 
258  QVariant widgetValue() const override;
259 
260  private:
261 
262  QgsUnitTypes::DistanceUnit mBaseUnit = QgsUnitTypes::DistanceUnknownUnit;
263  QLabel *mLabel = nullptr;
264  QWidget *mWarningLabel = nullptr;
265  QComboBox *mUnitsCombo = nullptr;
266 
267  friend class TestProcessingGui;
268 };
269 
270 
271 class GUI_EXPORT QgsProcessingScaleWidgetWrapper : public QgsProcessingNumericWidgetWrapper
272 {
273  Q_OBJECT
274 
275  public:
276 
277  QgsProcessingScaleWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
278  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
279 
280  // QgsProcessingParameterWidgetFactoryInterface
281  QString parameterType() const override;
282  QgsAbstractProcessingParameterWidgetWrapper *createWidgetWrapper( const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type ) override;
283 
284  // QgsProcessingParameterWidgetWrapper interface
285  QWidget *createWidget() override SIP_FACTORY;
286  void setWidgetContext( const QgsProcessingParameterWidgetContext &context ) override;
287  protected:
288 
289  QVariant widgetValue() const override;
290  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
291 
292  private:
293 
294  QgsScaleWidget *mScaleWidget = nullptr;
295 
296  friend class TestProcessingGui;
297 };
298 
299 class GUI_EXPORT QgsProcessingRangeWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
300 {
301  Q_OBJECT
302 
303  public:
304 
305  QgsProcessingRangeWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
306  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
307 
308  // QgsProcessingParameterWidgetFactoryInterface
309  QString parameterType() const override;
310  QgsAbstractProcessingParameterWidgetWrapper *createWidgetWrapper( const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type ) override;
311 
312  // QgsProcessingParameterWidgetWrapper interface
313  QWidget *createWidget() override SIP_FACTORY;
314 
315  protected:
316 
317  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
318  QVariant widgetValue() const override;
319  QStringList compatibleParameterTypes() const override;
320  QStringList compatibleOutputTypes() const override;
321  QList< int > compatibleDataTypes() const override;
322  QString modelerExpressionFormatString() const override;
323 
324  protected:
325 
326  QgsDoubleSpinBox *mMinSpinBox = nullptr;
327  QgsDoubleSpinBox *mMaxSpinBox = nullptr;
328 
329  private:
330 
331  int mBlockChangedSignal = 0;
332 
333  friend class TestProcessingGui;
334 };
335 
336 
337 class GUI_EXPORT QgsProcessingMatrixWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
338 {
339  Q_OBJECT
340 
341  public:
342 
343  QgsProcessingMatrixWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
344  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
345 
346  // QgsProcessingParameterWidgetFactoryInterface
347  QString parameterType() const override;
348  QgsAbstractProcessingParameterWidgetWrapper *createWidgetWrapper( const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type ) override;
349 
350  // QgsProcessingParameterWidgetWrapper interface
351  QWidget *createWidget() override SIP_FACTORY;
352 
353  protected:
354 
355  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
356  QVariant widgetValue() const override;
357 
358  QStringList compatibleParameterTypes() const override;
359  QStringList compatibleOutputTypes() const override;
360  QList< int > compatibleDataTypes() const override;
361  QString modelerExpressionFormatString() const override;
362 
363  private:
364 
365  QgsProcessingMatrixParameterPanel *mMatrixWidget = nullptr;
366 
367  friend class TestProcessingGui;
368 };
369 
370 class GUI_EXPORT QgsProcessingFileWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
371 {
372  Q_OBJECT
373 
374  public:
375 
376  QgsProcessingFileWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
377  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
378 
379  // QgsProcessingParameterWidgetFactoryInterface
380  QString parameterType() const override;
381  QgsAbstractProcessingParameterWidgetWrapper *createWidgetWrapper( const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type ) override;
382 
383  // QgsProcessingParameterWidgetWrapper interface
384  QWidget *createWidget() override SIP_FACTORY;
385 
386  protected:
387 
388  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
389  QVariant widgetValue() const override;
390 
391  QStringList compatibleParameterTypes() const override;
392 
393  QStringList compatibleOutputTypes() const override;
394 
395  QList< int > compatibleDataTypes() const override;
396  QString modelerExpressionFormatString() const override;
397 
398  private:
399 
400  QgsFileWidget *mFileWidget = nullptr;
401 
402  friend class TestProcessingGui;
403 };
404 
405 class GUI_EXPORT QgsProcessingExpressionWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
406 {
407  Q_OBJECT
408 
409  public:
410 
411  QgsProcessingExpressionWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
412  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
413 
414  // QgsProcessingParameterWidgetFactoryInterface
415  QString parameterType() const override;
416  QgsAbstractProcessingParameterWidgetWrapper *createWidgetWrapper( const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type ) override;
417 
418  // QgsProcessingParameterWidgetWrapper interface
419  QWidget *createWidget() override SIP_FACTORY;
420  void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
421  public slots:
422  void setParentLayerWrapperValue( const QgsAbstractProcessingParameterWidgetWrapper *parentWrapper );
423  protected:
424 
425  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
426  QVariant widgetValue() const override;
427 
428  QStringList compatibleParameterTypes() const override;
429 
430  QStringList compatibleOutputTypes() const override;
431 
432  QList< int > compatibleDataTypes() const override;
433  QString modelerExpressionFormatString() const override;
434  const QgsVectorLayer *linkedVectorLayer() const override;
435  private:
436 
437  QgsFieldExpressionWidget *mFieldExpWidget = nullptr;
438  QgsExpressionLineEdit *mExpLineEdit = nullptr;
439  std::unique_ptr< QgsVectorLayer > mParentLayer;
440 
441  friend class TestProcessingGui;
442 };
443 
444 
445 class GUI_EXPORT QgsProcessingEnumCheckboxPanelWidget : public QWidget
446 {
447  Q_OBJECT
448 
449  public:
450 
451  QgsProcessingEnumCheckboxPanelWidget( QWidget *parent = nullptr, const QgsProcessingParameterEnum *param = nullptr, int columns = 2 );
452  QVariant value() const;
453  void setValue( const QVariant &value );
454 
455  signals:
456 
457  void changed();
458 
459  private slots:
460 
461  void showPopupMenu();
462  void selectAll();
463  void deselectAll();
464 
465  private:
466 
467  const QgsProcessingParameterEnum *mParam = nullptr;
468  QMap< QVariant, QAbstractButton * > mButtons;
469  QButtonGroup *mButtonGroup = nullptr;
470  int mColumns = 2;
471  bool mBlockChangedSignal = false;
472 
473  friend class TestProcessingGui;
474 };
475 
476 class GUI_EXPORT QgsProcessingEnumPanelWidget : public QWidget
477 {
478  Q_OBJECT
479 
480  public:
481 
482  QgsProcessingEnumPanelWidget( QWidget *parent = nullptr, const QgsProcessingParameterEnum *param = nullptr );
483  QVariant value() const { return mValue; }
484  void setValue( const QVariant &value );
485 
486  signals:
487 
488  void changed();
489 
490  private slots:
491 
492  void showDialog();
493 
494  private:
495 
496  void updateSummaryText();
497 
498  const QgsProcessingParameterEnum *mParam = nullptr;
499  QLineEdit *mLineEdit = nullptr;
500  QToolButton *mToolButton = nullptr;
501 
502  QVariantList mValue;
503 
504  friend class TestProcessingGui;
505 };
506 
507 
508 class GUI_EXPORT QgsProcessingEnumWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
509 {
510  Q_OBJECT
511 
512  public:
513 
514  QgsProcessingEnumWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
515  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
516 
517  // QgsProcessingParameterWidgetFactoryInterface
518  QString parameterType() const override;
519  QgsAbstractProcessingParameterWidgetWrapper *createWidgetWrapper( const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type ) override;
520 
521  // QgsProcessingParameterWidgetWrapper interface
522  QWidget *createWidget() override SIP_FACTORY;
523 
524  protected:
525 
526  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
527  QVariant widgetValue() const override;
528 
529  QStringList compatibleParameterTypes() const override;
530 
531  QStringList compatibleOutputTypes() const override;
532 
533  QList< int > compatibleDataTypes() const override;
534  QString modelerExpressionFormatString() const override;
535  private:
536 
537  QComboBox *mComboBox = nullptr;
538  QgsProcessingEnumPanelWidget *mPanel = nullptr;
539  QgsProcessingEnumCheckboxPanelWidget *mCheckboxPanel = nullptr;
540 
541  friend class TestProcessingGui;
542 };
543 
544 
545 
546 class GUI_EXPORT QgsProcessingLayoutWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
547 {
548  Q_OBJECT
549 
550  public:
551 
552  QgsProcessingLayoutWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
553  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
554 
555  // QgsProcessingParameterWidgetFactoryInterface
556  QString parameterType() const override;
557  QgsAbstractProcessingParameterWidgetWrapper *createWidgetWrapper( const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type ) override;
558 
559  // QgsProcessingParameterWidgetWrapper interface
560  QWidget *createWidget() override SIP_FACTORY;
561 
562  protected:
563 
564  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
565  QVariant widgetValue() const override;
566 
567  QStringList compatibleParameterTypes() const override;
568 
569  QStringList compatibleOutputTypes() const override;
570 
571  QList< int > compatibleDataTypes() const override;
572  QString modelerExpressionFormatString() const override;
573  private:
574 
575  QgsLayoutComboBox *mComboBox = nullptr;
576  QLineEdit *mLineEdit = nullptr;
577 
578  friend class TestProcessingGui;
579 };
580 
581 
582 class GUI_EXPORT QgsProcessingLayoutItemWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
583 {
584  Q_OBJECT
585 
586  public:
587 
588  QgsProcessingLayoutItemWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
589  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
590 
591  // QgsProcessingParameterWidgetFactoryInterface
592  QString parameterType() const override;
593  QgsAbstractProcessingParameterWidgetWrapper *createWidgetWrapper( const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type ) override;
594 
595  // QgsProcessingParameterWidgetWrapper interface
596  QWidget *createWidget() override SIP_FACTORY;
597  void postInitialize( const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers ) override;
598 
599 
600  public slots:
601  void setLayoutParameterValue( const QVariant &value );
602  void setLayout( QgsPrintLayout *layout );
603 
604  protected:
605 
606  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
607  QVariant widgetValue() const override;
608 
609  QStringList compatibleParameterTypes() const override;
610 
611  QStringList compatibleOutputTypes() const override;
612 
613  QList< int > compatibleDataTypes() const override;
614  QString modelerExpressionFormatString() const override;
615  private:
616 
617  QgsLayoutItemComboBox *mComboBox = nullptr;
618  QLineEdit *mLineEdit = nullptr;
619 
620  friend class TestProcessingGui;
621 };
622 
623 class GUI_EXPORT QgsProcessingPointMapTool : public QgsMapTool
624 {
625  Q_OBJECT
626  public:
627  QgsProcessingPointMapTool( QgsMapCanvas *canvas );
628  ~QgsProcessingPointMapTool() override;
629  void deactivate() override;
630  void canvasMoveEvent( QgsMapMouseEvent *e ) override;
631  void canvasPressEvent( QgsMapMouseEvent *e ) override;
632  void keyPressEvent( QKeyEvent *e ) override;
633 
634  signals:
635 
636  void clicked( const QgsPointXY &point );
637  void complete();
638 
639  private:
640 
641  std::unique_ptr<QgsSnapIndicator> mSnapIndicator;
642  friend class TestProcessingGui;
643 };
644 
645 class GUI_EXPORT QgsProcessingPointPanel : public QWidget
646 {
647  Q_OBJECT
648 
649  public:
650 
651  QgsProcessingPointPanel( QWidget *parent );
652  void setMapCanvas( QgsMapCanvas *canvas );
653  void setAllowNull( bool allowNull );
654 
655  QVariant value() const;
656  void clear();
657  void setValue( const QgsPointXY &point, const QgsCoordinateReferenceSystem &crs );
658 
659  signals:
660 
661  void toggleDialogVisibility( bool visible );
662  void changed();
663 
664  private slots:
665 
666  void selectOnCanvas();
667  void updatePoint( const QgsPointXY &point );
668  void pointPicked();
669 
670  private:
671 
672  QgsFilterLineEdit *mLineEdit = nullptr;
673  QToolButton *mButton = nullptr;
674  QgsMapCanvas *mCanvas = nullptr;
676  QPointer< QgsMapTool > mPrevTool;
677  std::unique_ptr< QgsProcessingPointMapTool > mTool;
678  friend class TestProcessingGui;
679 };
680 
681 
682 class GUI_EXPORT QgsProcessingPointWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
683 {
684  Q_OBJECT
685 
686  public:
687 
688  QgsProcessingPointWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
689  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
690 
691  // QgsProcessingParameterWidgetFactoryInterface
692  QString parameterType() const override;
693  QgsAbstractProcessingParameterWidgetWrapper *createWidgetWrapper( const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type ) override;
694 
695  // QgsProcessingParameterWidgetWrapper interface
696  QWidget *createWidget() override SIP_FACTORY;
697  void setWidgetContext( const QgsProcessingParameterWidgetContext &context ) override;
698  void setDialog( QDialog *dialog ) override;
699 
700  protected:
701 
702  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
703  QVariant widgetValue() const override;
704 
705  QStringList compatibleParameterTypes() const override;
706 
707  QStringList compatibleOutputTypes() const override;
708 
709  QList< int > compatibleDataTypes() const override;
710  QString modelerExpressionFormatString() const override;
711  private:
712 
713  QgsProcessingPointPanel *mPanel = nullptr;
714  QLineEdit *mLineEdit = nullptr;
715  QDialog *mDialog = nullptr;
716 
717  friend class TestProcessingGui;
718 };
719 
721 
722 #endif // QGSPROCESSINGWIDGETWRAPPERIMPL_H
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value...
The QgsFieldExpressionWidget class reates a widget to choose fields and edit expressions It contains ...
A widget wrapper for Processing parameter value widgets.
A combobox which lets the user select map scale from predefined list and highlights nearest to curren...
WidgetType
Types of dialogs which Processing widgets can be created for.
An interface for Processing widget wrapper factories.
A class to represent a 2D point.
Definition: qgspointxy.h:43
Helper functions for various unit types.
Definition: qgsunittypes.h:38
The QgsSpinBox is a spin box with a clear button that will set the value to the defined clear value...
Definition: qgsspinbox.h:42
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
const QgsCoordinateReferenceSystem & crs
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:73
virtual QgsAbstractProcessingParameterWidgetWrapper * createWidgetWrapper(const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type)=0
Creates a new widget wrapper for the specified parameter definition.
The QgsLayoutItemComboBox class is a combo box which displays items of a matching type from a layout...
The QgsFileWidget class creates a widget for selecting a file or a folder.
Definition: qgsfilewidget.h:35
An enum based parameter for processing algorithms, allowing for selection from predefined values...
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
Definition: qgsgeos.h:79
QLineEdit subclass with built in support for clearing the widget&#39;s value and handling custom null val...
#define SIP_FACTORY
Definition: qgis_sip.h:69
A widget for selecting a projection.
virtual QString parameterType() const =0
Returns the type string for the parameter type the factory is associated with.
Abstract base class for all map tools.
Definition: qgsmaptool.h:62
Contains settings which reflect the context in which a Processing parameter widget is shown...
The QgsExpressionLineEdit widget includes a line edit for entering expressions together with a button...
This class represents a coordinate reference system (CRS).
Base class for the definition of processing parameters.
Class that shows snapping marker on map canvas for the current snapping match.
virtual QWidget * createWidget()=0
Creates a new widget which allows customization of the parameter&#39;s value.
Print layout, a QgsLayout subclass for static or atlas-based layouts.
Represents a vector layer which manages a vector based data sets.
Contains information about the context in which a processing algorithm is executed.
The QgsLayoutComboBox class is a combo box which displays available layouts from a QgsLayoutManager...
Selector widget for authentication configs.
Standard algorithm dialog.