Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix ownership of algorithm instance used by processing dialog
(cherry picked from commit a350b42)
- Loading branch information
|
@@ -38,11 +38,14 @@ Base class for processing algorithm dialogs. |
|
|
%Docstring |
|
|
Constructor for QgsProcessingAlgorithmDialogBase. |
|
|
%End |
|
|
~QgsProcessingAlgorithmDialogBase(); |
|
|
|
|
|
void setAlgorithm( QgsProcessingAlgorithm *algorithm ); |
|
|
void setAlgorithm( QgsProcessingAlgorithm *algorithm /Transfer/ ); |
|
|
%Docstring |
|
|
Sets the ``algorithm`` to run in the dialog. |
|
|
|
|
|
Ownership of the algorithm instance is transferred to the dialog. |
|
|
|
|
|
.. seealso:: :py:func:`algorithm` |
|
|
%End |
|
|
|
|
|
|
@@ -119,9 +119,11 @@ QgsProcessingAlgorithmDialogBase::QgsProcessingAlgorithmDialogBase( QWidget *par |
|
|
connect( QgsApplication::taskManager(), &QgsTaskManager::taskTriggered, this, &QgsProcessingAlgorithmDialogBase::taskTriggered ); |
|
|
} |
|
|
|
|
|
QgsProcessingAlgorithmDialogBase::~QgsProcessingAlgorithmDialogBase() = default; |
|
|
|
|
|
void QgsProcessingAlgorithmDialogBase::setAlgorithm( QgsProcessingAlgorithm *algorithm ) |
|
|
{ |
|
|
mAlgorithm = algorithm; |
|
|
mAlgorithm.reset( algorithm ); |
|
|
QString title; |
|
|
if ( ( QgsGui::higFlags() & QgsGui::HigDialogTitleIsTitleCase ) && !( algorithm->flags() & QgsProcessingAlgorithm::FlagDisplayNameIsLiteral ) ) |
|
|
{ |
|
@@ -156,7 +158,7 @@ void QgsProcessingAlgorithmDialogBase::setAlgorithm( QgsProcessingAlgorithm *alg |
|
|
|
|
|
QgsProcessingAlgorithm *QgsProcessingAlgorithmDialogBase::algorithm() |
|
|
{ |
|
|
return mAlgorithm; |
|
|
return mAlgorithm.get(); |
|
|
} |
|
|
|
|
|
void QgsProcessingAlgorithmDialogBase::setMainWidget( QWidget *widget ) |
|
|
|
@@ -99,12 +99,16 @@ class GUI_EXPORT QgsProcessingAlgorithmDialogBase : public QDialog, private Ui:: |
|
|
* Constructor for QgsProcessingAlgorithmDialogBase. |
|
|
*/ |
|
|
QgsProcessingAlgorithmDialogBase( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags flags = nullptr ); |
|
|
~QgsProcessingAlgorithmDialogBase() override; |
|
|
|
|
|
/** |
|
|
* Sets the \a algorithm to run in the dialog. |
|
|
* |
|
|
* Ownership of the algorithm instance is transferred to the dialog. |
|
|
* |
|
|
* \see algorithm() |
|
|
*/ |
|
|
void setAlgorithm( QgsProcessingAlgorithm *algorithm ); |
|
|
void setAlgorithm( QgsProcessingAlgorithm *algorithm SIP_TRANSFER ); |
|
|
|
|
|
/** |
|
|
* Returns the algorithm running in the dialog. |
|
@@ -333,7 +337,7 @@ class GUI_EXPORT QgsProcessingAlgorithmDialogBase : public QDialog, private Ui:: |
|
|
bool mExecuted = false; |
|
|
QVariantMap mResults; |
|
|
QWidget *mMainWidget = nullptr; |
|
|
QgsProcessingAlgorithm *mAlgorithm = nullptr; |
|
|
std::unique_ptr< QgsProcessingAlgorithm > mAlgorithm; |
|
|
QgsProcessingAlgRunnerTask *mAlgorithmTask = nullptr; |
|
|
|
|
|
bool mHelpCollapsed = false; |
|
|