Fix confusing override of accept method for non-dialog acceptance

This commit is contained in:
Nyall Dawson 2018-11-17 14:51:31 +10:00
parent 47bf1f49d8
commit 6fff62e668
4 changed files with 17 additions and 11 deletions

View File

@ -116,9 +116,6 @@ the given ``format``.
public slots:
virtual void accept();
void reportError( const QString &error, bool fatalError );
%Docstring
Reports an ``error`` string to the dialog's log.
@ -271,6 +268,11 @@ Formats an input ``string`` for display in the log tab.
virtual void finished( bool successful, const QVariantMap &result, QgsProcessingContext &context, QgsProcessingFeedback *feedback );
%Docstring
Called when the algorithm has finished executing.
%End
virtual void runAlgorithm();
%Docstring
Called when the dialog's algorithm should be run. Must be overridden by subclasses.
%End
};

View File

@ -159,7 +159,7 @@ class AlgorithmDialog(QgsProcessingAlgorithmDialogBase):
return self.algorithm().preprocessParameters(parameters)
def accept(self):
def runAlgorithm(self):
feedback = self.createFeedback()
context = dataobjects.createContext(feedback)

View File

@ -95,7 +95,7 @@ QgsProcessingAlgorithmDialogBase::QgsProcessingAlgorithmDialogBase( QWidget *par
splitterChanged( 0, 0 );
connect( mButtonBox, &QDialogButtonBox::rejected, this, &QgsProcessingAlgorithmDialogBase::closeClicked );
connect( mButtonBox, &QDialogButtonBox::accepted, this, &QgsProcessingAlgorithmDialogBase::accept );
connect( mButtonBox, &QDialogButtonBox::accepted, this, &QgsProcessingAlgorithmDialogBase::runAlgorithm );
// Rename OK button to Run
mButtonRun = mButtonBox->button( QDialogButtonBox::Ok );
@ -262,10 +262,6 @@ void QgsProcessingAlgorithmDialogBase::finished( bool, const QVariantMap &, QgsP
}
void QgsProcessingAlgorithmDialogBase::accept()
{
}
void QgsProcessingAlgorithmDialogBase::openHelp()
{
QUrl algHelp = mAlgorithm->helpUrl();
@ -464,6 +460,11 @@ void QgsProcessingAlgorithmDialogBase::closeEvent( QCloseEvent *e )
}
}
void QgsProcessingAlgorithmDialogBase::runAlgorithm()
{
}
void QgsProcessingAlgorithmDialogBase::setPercentage( double percent )
{
// delay setting maximum progress value until we know algorithm reports progress

View File

@ -168,8 +168,6 @@ class GUI_EXPORT QgsProcessingAlgorithmDialogBase : public QDialog, private Ui::
public slots:
void accept() override;
/**
* Reports an \a error string to the dialog's log.
*
@ -315,6 +313,11 @@ class GUI_EXPORT QgsProcessingAlgorithmDialogBase : public QDialog, private Ui::
*/
virtual void finished( bool successful, const QVariantMap &result, QgsProcessingContext &context, QgsProcessingFeedback *feedback );
/**
* Called when the dialog's algorithm should be run. Must be overridden by subclasses.
*/
virtual void runAlgorithm();
private slots:
void openHelp();