Skip to content

Commit 6fff62e

Browse files
committed
Fix confusing override of accept method for non-dialog acceptance
1 parent 47bf1f4 commit 6fff62e

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

python/gui/auto_generated/processing/qgsprocessingalgorithmdialogbase.sip.in

+5-3
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,6 @@ the given ``format``.
116116

117117
public slots:
118118

119-
virtual void accept();
120-
121-
122119
void reportError( const QString &error, bool fatalError );
123120
%Docstring
124121
Reports an ``error`` string to the dialog's log.
@@ -271,6 +268,11 @@ Formats an input ``string`` for display in the log tab.
271268
virtual void finished( bool successful, const QVariantMap &result, QgsProcessingContext &context, QgsProcessingFeedback *feedback );
272269
%Docstring
273270
Called when the algorithm has finished executing.
271+
%End
272+
273+
virtual void runAlgorithm();
274+
%Docstring
275+
Called when the dialog's algorithm should be run. Must be overridden by subclasses.
274276
%End
275277

276278
};

python/plugins/processing/gui/AlgorithmDialog.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def getParameterValues(self):
159159

160160
return self.algorithm().preprocessParameters(parameters)
161161

162-
def accept(self):
162+
def runAlgorithm(self):
163163
feedback = self.createFeedback()
164164
context = dataobjects.createContext(feedback)
165165

src/gui/processing/qgsprocessingalgorithmdialogbase.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ QgsProcessingAlgorithmDialogBase::QgsProcessingAlgorithmDialogBase( QWidget *par
9595
splitterChanged( 0, 0 );
9696

9797
connect( mButtonBox, &QDialogButtonBox::rejected, this, &QgsProcessingAlgorithmDialogBase::closeClicked );
98-
connect( mButtonBox, &QDialogButtonBox::accepted, this, &QgsProcessingAlgorithmDialogBase::accept );
98+
connect( mButtonBox, &QDialogButtonBox::accepted, this, &QgsProcessingAlgorithmDialogBase::runAlgorithm );
9999

100100
// Rename OK button to Run
101101
mButtonRun = mButtonBox->button( QDialogButtonBox::Ok );
@@ -262,10 +262,6 @@ void QgsProcessingAlgorithmDialogBase::finished( bool, const QVariantMap &, QgsP
262262

263263
}
264264

265-
void QgsProcessingAlgorithmDialogBase::accept()
266-
{
267-
}
268-
269265
void QgsProcessingAlgorithmDialogBase::openHelp()
270266
{
271267
QUrl algHelp = mAlgorithm->helpUrl();
@@ -464,6 +460,11 @@ void QgsProcessingAlgorithmDialogBase::closeEvent( QCloseEvent *e )
464460
}
465461
}
466462

463+
void QgsProcessingAlgorithmDialogBase::runAlgorithm()
464+
{
465+
466+
}
467+
467468
void QgsProcessingAlgorithmDialogBase::setPercentage( double percent )
468469
{
469470
// delay setting maximum progress value until we know algorithm reports progress

src/gui/processing/qgsprocessingalgorithmdialogbase.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,6 @@ class GUI_EXPORT QgsProcessingAlgorithmDialogBase : public QDialog, private Ui::
168168

169169
public slots:
170170

171-
void accept() override;
172-
173171
/**
174172
* Reports an \a error string to the dialog's log.
175173
*
@@ -315,6 +313,11 @@ class GUI_EXPORT QgsProcessingAlgorithmDialogBase : public QDialog, private Ui::
315313
*/
316314
virtual void finished( bool successful, const QVariantMap &result, QgsProcessingContext &context, QgsProcessingFeedback *feedback );
317315

316+
/**
317+
* Called when the dialog's algorithm should be run. Must be overridden by subclasses.
318+
*/
319+
virtual void runAlgorithm();
320+
318321
private slots:
319322

320323
void openHelp();

0 commit comments

Comments
 (0)