QGIS API Documentation 3.99.0-Master (09f76ad7019)
Loading...
Searching...
No Matches
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 "ui_qgsprocessingdestinationwidgetbase.h"
20
21#include "qgis.h"
22#include "qgis_gui.h"
25
26#include <QAction>
27#include <QWidget>
28
31class QCheckBox;
33
40class GUI_EXPORT QgsProcessingLayerOutputDestinationWidget : public QWidget, private Ui::QgsProcessingDestinationWidgetBase
41{
42 Q_OBJECT
43
44 public:
48 QgsProcessingLayerOutputDestinationWidget( const QgsProcessingDestinationParameter *parameter, bool defaultSelection, QWidget *parent SIP_TRANSFERTHIS = nullptr );
49
53 bool outputIsSkipped() const;
54
58 void setValue( const QVariant &value );
59
63 QVariant value() const;
64
70 void setWidgetContext( const QgsProcessingParameterWidgetContext &context );
71
75 void setContext( QgsProcessingContext *context );
76
83 void registerProcessingParametersGenerator( QgsProcessingParametersGenerator *generator );
84
88 void addOpenAfterRunningOption();
89
93 bool openAfterRunning() const;
94
95 signals:
96
100 void skipOutputChanged( bool skipped );
101
105 void destinationChanged();
106
107 protected:
108 void dragEnterEvent( QDragEnterEvent *event ) override;
109 void dragLeaveEvent( QDragLeaveEvent *event ) override;
110 void dropEvent( QDropEvent *event ) override;
111
112 private slots:
113
114 void menuAboutToShow();
115 void skipOutput();
116 void saveToTemporary( const QString &name = QString() );
117 void selectDirectory();
118 void selectFile();
119 void saveToGeopackage();
120 void saveToDatabase();
121 void appendToLayer();
122 void selectEncoding();
123 void textChanged( const QString &text );
124
125 private:
126 void setAppendDestination( const QString &uri, const QgsFields &destFields );
127
131 bool couldBeTemporaryLayerName( const QString &value ) const;
132 QString memoryProviderLayerName( const QString &value ) const;
133
134 /*
135 * Checks if two string descriptions of temporary outputs should be considered equal.
136 */
137 bool consideredEqualTemporaryOutputValues( const QString &val1, const QString &val2 ) const;
138
139 /*
140 * Converts a QVariant value to a string for comparison purposes, handling standard types nad QgsProcessingOutputLayerDefinition.
141 */
142 QString variantToString( const QVariant &value ) const;
143
144 void setupPlaceholderText();
145
146 QString mimeDataToPath( const QMimeData *data );
147
148 const QgsProcessingDestinationParameter *mParameter = nullptr;
149 QgsProcessingParametersGenerator *mParametersGenerator = nullptr;
150 QMenu *mMenu = nullptr;
151
152 bool mUseTemporary = true;
153 bool mDefaultSelection = false;
154 QString mEncoding;
155 QgsBrowserGuiModel *mBrowserModel = nullptr;
156 QCheckBox *mOpenAfterRunningCheck = nullptr;
157
158 QgsRemappingSinkDefinition mRemapDefinition;
159 bool mUseRemapping = false;
160
161 QString mFormat;
162
163 QgsProcessingContext *mContext = nullptr;
164
165 QAction *mActionTemporaryOutputIcon = nullptr;
166
167 // value used in leText in previous state, for comparison
168 QString mPreviousValueString = QgsProcessing::TEMPORARY_OUTPUT;
169
170 friend class TestProcessingGui;
171};
172
174
175#endif // QGSPROCESSINGOUTPUTDESTINATIONWIDGET_H
A model for showing available data sources and other items in a structured tree.
Base class for all parameter definitions which represent file or layer destinations,...
static const QString TEMPORARY_OUTPUT
Constant used to indicate that a Processing algorithm output should be a temporary layer/file.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53