QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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 
23 #include "qgsvectortilewriter.h"
24 
25 #include "ui_qgsprocessingvectortilewriterlayerdetailswidgetbase.h"
26 
27 class QLineEdit;
28 class QToolButton;
29 
31 
32 
33 class QgsProcessingVectorTileWriteLayerDetailsWidget : public QgsPanelWidget, private Ui::QgsProcessingVectorTileWriterLayerDetailsWidget
34 {
35  public:
36  QgsProcessingVectorTileWriteLayerDetailsWidget( const QVariant &value, QgsProject *project );
37 
38  QVariant value() const;
39 
40  QDialogButtonBox *buttonBox() { return mButtonBox; }
41 
42  private:
43  QgsVectorLayer *mLayer = nullptr;
44 };
45 
46 
47 class QgsProcessingVectorTileWriterLayersPanelWidget : public QgsProcessingMultipleSelectionPanelWidget
48 {
49  Q_OBJECT
50 
51  public:
52 
56  QgsProcessingVectorTileWriterLayersPanelWidget(
57  const QVariant &value,
58  QgsProject *project,
59  QWidget *parent SIP_TRANSFERTHIS = nullptr );
60 
61  private slots:
62 
63  void configureLayer();
64  void copyLayer();
65 
66  private:
67  void setItemValue( QStandardItem *item, const QVariant &value );
68  QString titleForLayer( const QgsVectorTileWriter::Layer &layer );
69 
70  QgsProject *mProject = nullptr;
71 };
72 
73 
74 
75 class QgsProcessingVectorTileWriterLayersWidget : public QWidget
76 {
77  Q_OBJECT
78 
79  public:
80 
81  QgsProcessingVectorTileWriterLayersWidget( QWidget *parent = nullptr );
82 
83  QVariant value() const { return mValue; }
84  void setValue( const QVariant &value );
85 
86  void setProject( QgsProject *project );
87 
88  signals:
89 
90  void changed();
91 
92  private slots:
93 
94  void showDialog();
95 
96  private:
97 
98  void updateSummaryText();
99 
100  QLineEdit *mLineEdit = nullptr;
101  QToolButton *mToolButton = nullptr;
102 
103  QVariantList mValue;
104 
105  QgsProject *mProject = nullptr;
106 
107  friend class TestProcessingGui;
108 };
109 
110 
111 class QgsProcessingVectorTileWriterLayersWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
112 {
113  Q_OBJECT
114 
115  public:
116 
117  QgsProcessingVectorTileWriterLayersWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
118  QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
119 
120  // QgsProcessingParameterWidgetFactoryInterface
121  QString parameterType() const override;
123 
124  // QgsProcessingParameterWidgetWrapper interface
125  QWidget *createWidget() override SIP_FACTORY;
126  void setWidgetContext( const QgsProcessingParameterWidgetContext &context ) override;
127 
128  protected:
129 
130  void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) override;
131  QVariant widgetValue() const override;
132 
133  QStringList compatibleParameterTypes() const override;
134  QStringList compatibleOutputTypes() const override;
135 
136  private:
137 
138  QgsProcessingVectorTileWriterLayersWidget *mPanel = nullptr;
139 
140  friend class TestProcessingGui;
141 };
142 
143 
145 
146 #endif // QGSPROCESSINGVECTORTILEWRITERLAYERSWIDGETWRAPPER_H
QgsProcessingParameterWidgetContext
Contains settings which reflect the context in which a Processing parameter widget is shown,...
Definition: qgsprocessingwidgetwrapper.h:100
QgsAbstractProcessingParameterWidgetWrapper::createWidget
virtual QWidget * createWidget()=0
Creates a new widget which allows customization of the parameter's value.
QgsProcessingParameterDefinition
Base class for the definition of processing parameters.
Definition: qgsprocessingparameters.h:331
QgsAbstractProcessingParameterWidgetWrapper
A widget wrapper for Processing parameter value widgets.
Definition: qgsprocessingwidgetwrapper.h:267
QgsProcessingParameterWidgetFactoryInterface::createWidgetWrapper
virtual QgsAbstractProcessingParameterWidgetWrapper * createWidgetWrapper(const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type)=0
Creates a new widget wrapper for the specified parameter definition.
QgsProject
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition: qgsproject.h:95
QgsProcessingGui::Standard
@ Standard
Standard algorithm dialog.
Definition: qgsprocessinggui.h:40
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:30
QgsProcessingParameterWidgetFactoryInterface::parameterType
virtual QString parameterType() const =0
Returns the type string for the parameter type the factory is associated with.
QgsProcessingContext
Contains information about the context in which a processing algorithm is executed.
Definition: qgsprocessingcontext.h:44
qgsprocessingwidgetwrapper.h
qgsvectortilewriter.h
QgsProcessingGui::WidgetType
WidgetType
Types of dialogs which Processing widgets can be created for.
Definition: qgsprocessinggui.h:39
QgsProcessingParameterWidgetFactoryInterface
An interface for Processing widget wrapper factories.
Definition: qgsprocessingwidgetwrapper.h:515
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:387
QgsVectorTileWriter::Layer
Configuration of a single input vector layer to be included in the output.
Definition: qgsvectortilewriter.h:85
qgsprocessingmultipleselectiondialog.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53