QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgsprocessingoutputdestinationwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsprocessingoutputdestinationwidget.h
3  ----------------------------------
4  Date : March 2020
5  Copyright : (C) 2020 Nyall Dawson
6  Email : nyall dot dawson 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 QGSPROCESSINGOUTPUTDESTINATIONWIDGET_H
17 #define QGSPROCESSINGOUTPUTDESTINATIONWIDGET_H
18 
19 #include "qgis.h"
20 #include "qgis_gui.h"
21 #include "ui_qgsprocessingdestinationwidgetbase.h"
23 #include "qgsprocessingcontext.h"
24 #include <QWidget>
25 
27 class QgsBrowserGuiModel;
28 class QCheckBox;
30 
37 class GUI_EXPORT QgsProcessingLayerOutputDestinationWidget : public QWidget, private Ui::QgsProcessingDestinationWidgetBase
38 {
39  Q_OBJECT
40 
41  public:
42 
46  QgsProcessingLayerOutputDestinationWidget( const QgsProcessingDestinationParameter *parameter, bool defaultSelection, QWidget *parent SIP_TRANSFERTHIS = nullptr );
47 
51  bool outputIsSkipped() const;
52 
56  void setValue( const QVariant &value );
57 
61  QVariant value() const;
62 
68  void setWidgetContext( const QgsProcessingParameterWidgetContext &context );
69 
73  void setContext( QgsProcessingContext *context );
74 
81  void registerProcessingParametersGenerator( QgsProcessingParametersGenerator *generator );
82 
86  void addOpenAfterRunningOption();
87 
91  bool openAfterRunning() const;
92 
93  signals:
94 
98  void skipOutputChanged( bool skipped );
99 
103  void destinationChanged();
104  protected:
105 
106  void dragEnterEvent( QDragEnterEvent *event ) override;
107  void dragLeaveEvent( QDragLeaveEvent *event ) override;
108  void dropEvent( QDropEvent *event ) override;
109 
110  private slots:
111 
112  void menuAboutToShow();
113  void skipOutput();
114  void saveToTemporary();
115  void selectDirectory();
116  void selectFile();
117  void saveToGeopackage();
118  void saveToDatabase();
119  void appendToLayer();
120  void selectEncoding();
121  void textChanged( const QString &text );
122 
123  private:
124 
125  void setAppendDestination( const QString &uri, const QgsFields &destFields );
126 
127  QString mimeDataToPath( const QMimeData *data );
128 
129  const QgsProcessingDestinationParameter *mParameter = nullptr;
130  QgsProcessingParametersGenerator *mParametersGenerator = nullptr;
131  QMenu *mMenu = nullptr;
132 
133  bool mUseTemporary = true;
134  bool mDefaultSelection = false;
135  QString mEncoding;
136  QgsBrowserGuiModel *mBrowserModel = nullptr;
137  QCheckBox *mOpenAfterRunningCheck = nullptr;
138 
139  QgsRemappingSinkDefinition mRemapDefinition;
140  bool mUseRemapping = false;
141 
142  QgsProcessingContext *mContext = nullptr;
143 
144  friend class TestProcessingGui;
145 };
146 
148 
149 #endif // QGSPROCESSINGOUTPUTDESTINATIONWIDGET_H
A model for showing available data sources and other items in a structured tree.
Container of fields for a vector layer.
Definition: qgsfields.h:45
Contains information about the context in which a processing algorithm is executed.
Base class for all parameter definitions which represent file or layer destinations,...
Contains settings which reflect the context in which a Processing parameter widget is shown,...
An interface for objects which can create sets of parameter values for processing algorithms.
Defines the parameters used to remap features when creating a QgsRemappingProxyFeatureSink.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53