Skip to content
Permalink
Browse files

Fix confusing override of accept method for non-dialog acceptance

(cherry picked from commit 3ce1662)
  • Loading branch information
nyalldawson committed Nov 17, 2018
1 parent d1cec84 commit 84dc8faa351cd38041d55d131f05a5a92c75a5cc
@@ -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

};
@@ -159,7 +159,7 @@ def getParameterValues(self):

return self.algorithm().preprocessParameters(parameters)

def accept(self):
def runAlgorithm(self):
feedback = self.createFeedback()
context = dataobjects.createContext(feedback)

@@ -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
@@ -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();

0 comments on commit 84dc8fa

Please sign in to comment.
You can’t perform that action at this time.