16 #ifndef QGSPROCESSINGALGORITHMDIALOGBASE_H 17 #define QGSPROCESSINGALGORITHMDIALOGBASE_H 21 #include "ui_qgsprocessingalgorithmdialogbase.h" 22 #include "ui_qgsprocessingalgorithmprogressdialogbase.h" 30 class QgsProcessingAlgorithmDialogBase;
52 QgsProcessingAlgorithmDialogFeedback() =
default;
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
SIP_TRANSFERTHIS =
nullptr, Qt::WindowFlags flags =
nullptr );
102 ~QgsProcessingAlgorithmDialogBase()
override;
129 QWidget *mainWidget();
141 bool wasExecuted()
const {
return mExecuted; }
148 QVariantMap results()
const {
return mResults; }
159 virtual QVariantMap getParameterValues() const;
167 void saveLogToFile( const QString &path, LogFormat format = FormatPlainText );
176 void reportError( const QString &error,
bool fatalError );
181 void pushInfo( const QString &info );
186 void pushDebugInfo( const QString &message );
191 void pushCommandInfo( const QString &info );
196 void setPercentage(
double percent );
201 void setProgressText( const QString &text );
206 void pushConsoleInfo( const QString &info );
212 QDialog *createProgressDialog();
231 void copyLogToClipboard();
235 void closeEvent( QCloseEvent *e ) override;
240 QPushButton *runButton();
245 QPushButton *cancelButton();
250 QDialogButtonBox *buttonBox();
255 QTabWidget *tabWidget();
260 void clearProgress();
267 void setExecuted(
bool executed );
274 void setResults( const QVariantMap &results );
279 void setInfo( const QString &message,
bool isError = false,
bool escapeHtml = true );
294 void hideShortHelp();
307 static QString formatStringForLog( const QString &
string );
319 virtual
void runAlgorithm();
324 void toggleCollapsed();
326 void splitterChanged(
int pos,
int index );
327 void linkClicked( const QUrl &url );
328 void algExecuted(
bool successful, const QVariantMap &results );
329 void taskTriggered(
QgsTask *task );
334 QPushButton *mButtonRun =
nullptr;
335 QPushButton *mButtonClose =
nullptr;
336 QByteArray mSplitterState;
337 QToolButton *mButtonCollapse =
nullptr;
340 bool mExecuted = false;
341 QVariantMap mResults;
342 QWidget *mMainWidget =
nullptr;
346 bool mHelpCollapsed = false;
349 void scrollToBottomOfLog();
350 void processEvents();
362 class QgsProcessingAlgorithmProgressDialog :
public QDialog,
private Ui::QgsProcessingProgressDialogBase
371 QgsProcessingAlgorithmProgressDialog( QWidget *parent =
nullptr );
376 QProgressBar *progressBar();
381 QPushButton *cancelButton();
386 QTextEdit *logTextEdit();
390 void reject()
override;
398 #endif // QGSPROCESSINGALGORITHMDIALOGBASE_H virtual void pushConsoleInfo(const QString &info)
Pushes a console feedback message from the algorithm.
Base class for providing feedback from a processing algorithm.
virtual void pushCommandInfo(const QString &info)
Pushes an informational message containing a command from the algorithm.
A bar for displaying non-blocking messages to the user.
Abstract base class for processing algorithms.
virtual void setProgressText(const QString &text)
Sets a progress report text string.
virtual void pushInfo(const QString &info)
Pushes a general informational message from the algorithm.
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
Abstract base class for long running background tasks.
virtual void pushDebugInfo(const QString &info)
Pushes an informational message containing debugging helpers from the algorithm.
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 reportError(const QString &error, bool fatalError=false)
Reports that the algorithm encountered an error while executing.
QgsTask task which runs a QgsProcessingAlgorithm in a background task.
Contains information about the context in which a processing algorithm is executed.