mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Fix ownership of algorithm instance used by processing dialog
This commit is contained in:
parent
4d97d20635
commit
47bf1f49d8
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user