16 #ifndef QGSPROCESSINGALGORITHMDIALOGBASE_H 17 #define QGSPROCESSINGALGORITHMDIALOGBASE_H 21 #include "ui_qgsprocessingalgorithmdialogbase.h" 22 #include "ui_qgsprocessingalgorithmprogressdialogbase.h" 30 class QgsProcessingAlgorithmDialogBase;
52 QgsProcessingAlgorithmDialogFeedback();
56 void progressTextChanged(
const QString &text );
57 void errorReported(
const QString &text,
bool fatalError );
58 void infoPushed(
const QString &text );
59 void commandInfoPushed(
const QString &text );
60 void debugInfoPushed(
const QString &text );
61 void consoleInfoPushed(
const QString &text );
66 void reportError(
const QString &error,
bool fatalError )
override;
67 void pushInfo(
const QString &info )
override;
82 class GUI_EXPORT QgsProcessingAlgorithmDialogBase :
public QDialog,
private Ui::QgsProcessingDialogBase
101 QgsProcessingAlgorithmDialogBase( QWidget *parent =
nullptr, Qt::WindowFlags flags =
nullptr );
125 QWidget *mainWidget();
137 bool wasExecuted()
const {
return mExecuted; }
144 QVariantMap results()
const {
return mResults; }
155 virtual QVariantMap getParameterValues() const;
163 void saveLogToFile( const QString &path, LogFormat format = FormatPlainText );
167 void accept() override;
174 void reportError( const QString &error,
bool fatalError );
179 void pushInfo( const QString &info );
184 void pushDebugInfo( const QString &message );
189 void pushCommandInfo( const QString &info );
194 void setPercentage(
double percent );
199 void setProgressText( const QString &text );
204 void pushConsoleInfo( const QString &info );
210 QDialog *createProgressDialog();
229 void copyLogToClipboard();
233 void closeEvent( QCloseEvent *e ) override;
238 QPushButton *runButton();
243 QPushButton *cancelButton();
248 QDialogButtonBox *buttonBox();
253 QTabWidget *tabWidget();
258 void clearProgress();
265 void setExecuted(
bool executed );
272 void setResults( const QVariantMap &results );
277 void setInfo( const QString &message,
bool isError = false,
bool escapeHtml = true );
292 void hideShortHelp();
305 static QString formatStringForLog( const QString &
string );
317 void toggleCollapsed();
319 void splitterChanged(
int pos,
int index );
320 void linkClicked( const QUrl &url );
321 void algExecuted(
bool successful, const QVariantMap &results );
322 void taskTriggered(
QgsTask *task );
327 QPushButton *mButtonRun =
nullptr;
328 QPushButton *mButtonClose =
nullptr;
329 QByteArray mSplitterState;
330 QToolButton *mButtonCollapse =
nullptr;
333 bool mExecuted = false;
334 QVariantMap mResults;
335 QWidget *mMainWidget =
nullptr;
339 bool mHelpCollapsed = false;
342 void scrollToBottomOfLog();
343 void processEvents();
355 class QgsProcessingAlgorithmProgressDialog :
public QDialog,
private Ui::QgsProcessingProgressDialogBase
364 QgsProcessingAlgorithmProgressDialog( QWidget *parent =
nullptr );
369 QProgressBar *progressBar();
374 QPushButton *cancelButton();
379 QTextEdit *logTextEdit();
383 void reject()
override;
391 #endif // QGSPROCESSINGALGORITHMDIALOGBASE_H Base class for providing feedback from a processing algorithm.
A bar for displaying non-blocking messages to the user.
virtual void setProgressText(const QString &text)
Sets a progress report text string.
Abstract base class for processing algorithms.
Abstract base class for long running background tasks.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call
virtual void pushDebugInfo(const QString &info)
Pushes an informational message containing debugging helpers from the algorithm.
virtual void pushConsoleInfo(const QString &info)
Pushes a console feedback message from the algorithm.
virtual void pushCommandInfo(const QString &info)
Pushes an informational message containing a command from the algorithm.
QgsTask task which runs a QgsProcessingAlgorithm in a background task.
Contains information about the context in which a processing algorithm is executed.
virtual void reportError(const QString &error, bool fatalError=false)
Reports that the algorithm encountered an error while executing.
virtual void pushInfo(const QString &info)
Pushes a general informational message from the algorithm.