Ensure expected button order in QgsProcessingAlgorithmDialogBase

This commit is contained in:
gacarrillor 2020-03-21 07:44:11 -05:00 committed by Nyall Dawson
parent 36a3e634f5
commit 6fb84776c8
4 changed files with 17 additions and 20 deletions

View File

@ -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;
@ -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:
@ -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.

View File

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

View File

@ -69,7 +69,6 @@ class QgsProcessingAlgorithmDialogFeedback : public QgsProcessingFeedback
void pushDebugInfo( const QString &info ) override;
void pushConsoleInfo( const QString &info ) override;
};
#endif
@ -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()
@ -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;
@ -281,7 +280,6 @@ class GUI_EXPORT QgsProcessingAlgorithmDialogBase : public QDialog, private Ui::
*/
void setExecutedAnyResult( bool executedAnyResult );
/**
* Sets the algorithm results.
* \see results()

View File

@ -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>