QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
qgsprocessingvectortilewriterlayerswidgetwrapper.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsprocessingvectortilewriterlayerswidgetwrapper.h
3  ---------------------
4  Date : April 2020
5  Copyright : (C) 2020 by Martin Dobias
6  Email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSPROCESSINGVECTORTILEWRITERLAYERSWIDGETWRAPPER_H
17 #define QGSPROCESSINGVECTORTILEWRITERLAYERSWIDGETWRAPPER_H
18 
19 #define SIP_NO_FILE
20 
21 #include "qgsprocessingcontext.h"
24 #include "qgsvectortilewriter.h"
25 
26 #include "ui_qgsprocessingvectortilewriterlayerdetailswidgetbase.h"
27 
28 class QLineEdit;
29 class QToolButton;
30 
32 
33 
34 class QgsProcessingVectorTileWriteLayerDetailsWidget : public QgsPanelWidget, private Ui::QgsProcessingVectorTileWriterLayerDetailsWidget
35 {
36  public:
37  QgsProcessingVectorTileWriteLayerDetailsWidget( const QVariant &value, QgsProject *project );
38 
39  QVariant value() const;
40 
41  QDialogButtonBox *buttonBox() { return mButtonBox; }
42 
43  private:
44  QgsVectorLayer *mLayer = nullptr;
45  QgsProcessingContext mContext;
46 };
47 
48 
49 class QgsProcessingVectorTileWriterLayersPanelWidget : public QgsProcessingMultipleSelectionPanelWidget
50 {
51  Q_OBJECT
52 
53  public:
54 
58  QgsProcessingVectorTileWriterLayersPanelWidget(
59  const QVariant &value,
60  QgsProject *project,
61  QWidget *parent SIP_TRANSFERTHIS = nullptr );
62 
63  private slots:
64 
65  void configureLayer();
66  void copyLayer();
67 
68  private:
69  void setItemValue( QStandardItem *item, const QVariant &value );
70  QString titleForLayer( const QgsVectorTileWriter::Layer &layer );
71 
72  QgsProject *mProject = nullptr;
73  QgsProcessingContext mContext;
74 };
75 
76 
77 
78 class QgsProcessingVectorTileWriterLayersWidget : public QWidget
79 {
80  Q_OBJECT
81 
82  public:
83 
84  QgsProcessingVectorTileWriterLayersWidget( QWidget *parent = nullptr );
85 
86  QVariant value() const { return mValue; }
87  void setValue( const QVariant &value );
88 
89  void setProject( QgsProject *project );
90 
91  signals:
92 
93  void changed();
94 
95  private slots:
96 
97  void showDialog();
98 
99  private:
100 
101  void updateSummaryText();
102 
103  QLineEdit *mLineEdit = nullptr;
104  QToolButton *mToolButton = nullptr;
105 
106  QVariantList mValue;
107 
108  QgsProject *mProject = nullptr;
109 
110  friend class TestProcessingGui;
111 };
112 
113 
114 class QgsProcessingVectorTileWriterLayersWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
115 {
116  Q_OBJECT
117 
118  public:
119 
120  QgsProcessingVectorTileWriterLayersWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
121  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
122 
123  // QgsProcessingParameterWidgetFactoryInterface
124  QString parameterType() const override;
126 
127  // QgsProcessingParameterWidgetWrapper interface
128  QWidget *createWidget() override SIP_FACTORY;
129  void setWidgetContext( const QgsProcessingParameterWidgetContext &context ) override;
130 
131  protected:
132 
133  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
134  QVariant widgetValue() const override;
135 
136  QStringList compatibleParameterTypes() const override;
137  QStringList compatibleOutputTypes() const override;
138 
139  private:
140 
141  QgsProcessingVectorTileWriterLayersWidget *mPanel = nullptr;
142 
143  friend class TestProcessingGui;
144 };
145 
146 
148 
149 #endif // QGSPROCESSINGVECTORTILEWRITERLAYERSWIDGETWRAPPER_H
A widget wrapper for Processing parameter value widgets.
virtual QWidget * createWidget()=0
Creates a new widget which allows customization of the parameter's value.
Base class for any widget that can be shown as a inline panel.
Contains information about the context in which a processing algorithm is executed.
WidgetType
Types of dialogs which Processing widgets can be created for.
@ Standard
Standard algorithm dialog.
Base class for the definition of processing parameters.
Contains settings which reflect the context in which a Processing parameter widget is shown,...
An interface for Processing widget wrapper factories.
virtual QgsAbstractProcessingParameterWidgetWrapper * createWidgetWrapper(const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type)=0
Creates a new widget wrapper for the specified parameter definition.
virtual QString parameterType() const =0
Returns the type string for the parameter type the factory is associated with.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition: qgsproject.h:101
Represents a vector layer which manages a vector based data sets.
Configuration of a single input vector layer to be included in the output.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
#define SIP_FACTORY
Definition: qgis_sip.h:76