Skip to content

Commit

Permalink
Ensure expected button order in QgsProcessingAlgorithmDialogBase
Browse files Browse the repository at this point in the history
  • Loading branch information
gacarrillor authored and nyalldawson committed Mar 23, 2020
1 parent 36a3e63 commit 6fb8477
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 20 deletions.
Expand Up @@ -73,11 +73,6 @@ Returns the main widget for the dialog, usually a panel for configuring algorith
void showLog();
%Docstring
Switches the dialog to the log page.
%End

void showParameters();
%Docstring
Switches the dialog to the parameters page.
%End

bool wasExecuted() const;
Expand Down Expand Up @@ -185,6 +180,11 @@ Opens a dialog allowing users to save the current log contents.
Copies the current log contents to the clipboard.

.. versionadded:: 3.2
%End

void showParameters();
%Docstring
Switches the dialog to the parameters page.
%End

protected:
Expand Down Expand Up @@ -236,7 +236,6 @@ Sets whether the algorithm was executed through the dialog.
Sets whether the algorithm was executed through the dialog (no matter the result).
%End


void setResults( const QVariantMap &results );
%Docstring
Sets the algorithm results.
Expand Down
12 changes: 6 additions & 6 deletions src/gui/processing/qgsprocessingalgorithmdialogbase.cpp
Expand Up @@ -95,20 +95,20 @@ QgsProcessingAlgorithmDialogBase::QgsProcessingAlgorithmDialogBase( QWidget *par
mSplitterState = splitter->saveState();
splitterChanged( 0, 0 );

connect( mButtonBox, &QDialogButtonBox::rejected, this, &QgsProcessingAlgorithmDialogBase::closeClicked );
connect( mButtonBox, &QDialogButtonBox::accepted, this, &QgsProcessingAlgorithmDialogBase::runAlgorithm );

// Rename OK button to Run
mButtonRun = mButtonBox->button( QDialogButtonBox::Ok );
mButtonRun->setText( tr( "Run" ) );

// Rename Yes button. Yes is used to ensure same position of Run and Change Parameters with respect to Close button.
mButtonChangeParameters = mButtonBox->button( QDialogButtonBox::Yes );
mButtonChangeParameters->setText( tr( "Change Parameters" ) );

buttonCancel->setEnabled( false );
mButtonClose = mButtonBox->button( QDialogButtonBox::Close );

mButtonChangeParameters = new QPushButton( tr( "Change Parameters" ) );
mButtonBox->addButton( mButtonChangeParameters, QDialogButtonBox::ActionRole );

connect( mButtonRun, &QPushButton::clicked, this, &QgsProcessingAlgorithmDialogBase::runAlgorithm );
connect( mButtonChangeParameters, &QPushButton::clicked, this, &QgsProcessingAlgorithmDialogBase::showParameters );
connect( mButtonBox, &QDialogButtonBox::rejected, this, &QgsProcessingAlgorithmDialogBase::closeClicked );
connect( mButtonBox, &QDialogButtonBox::helpRequested, this, &QgsProcessingAlgorithmDialogBase::openHelp );
connect( mButtonCollapse, &QToolButton::clicked, this, &QgsProcessingAlgorithmDialogBase::toggleCollapsed );
connect( splitter, &QSplitter::splitterMoved, this, &QgsProcessingAlgorithmDialogBase::splitterChanged );
Expand Down
12 changes: 5 additions & 7 deletions src/gui/processing/qgsprocessingalgorithmdialogbase.h
Expand Up @@ -69,7 +69,6 @@ class QgsProcessingAlgorithmDialogFeedback : public QgsProcessingFeedback
void pushDebugInfo( const QString &info ) override;
void pushConsoleInfo( const QString &info ) override;


};
#endif

Expand Down Expand Up @@ -133,11 +132,6 @@ class GUI_EXPORT QgsProcessingAlgorithmDialogBase : public QDialog, private Ui::
*/
void showLog();

/**
* Switches the dialog to the parameters page.
*/
void showParameters();

/**
* Returns TRUE if an algorithm was executed in the dialog.
* \see results()
Expand Down Expand Up @@ -235,6 +229,11 @@ class GUI_EXPORT QgsProcessingAlgorithmDialogBase : public QDialog, private Ui::
*/
void copyLogToClipboard();

/**
* Switches the dialog to the parameters page.
*/
void showParameters();

protected:

void closeEvent( QCloseEvent *e ) override;
Expand Down Expand Up @@ -281,7 +280,6 @@ class GUI_EXPORT QgsProcessingAlgorithmDialogBase : public QDialog, private Ui::
*/
void setExecutedAnyResult( bool executedAnyResult );


/**
* Sets the algorithm results.
* \see results()
Expand Down
2 changes: 1 addition & 1 deletion src/ui/processing/qgsprocessingalgorithmdialogbase.ui
Expand Up @@ -211,7 +211,7 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::Close|QDialogButtonBox::Help|QDialogButtonBox::Ok|QDialogButtonBox::Yes</set>
</property>
</widget>
</item>
Expand Down

0 comments on commit 6fb8477

Please sign in to comment.