make Cancel button checkable

This commit is contained in:
eap 2013-07-09 11:57:50 +00:00
parent 7c7b4b0636
commit f4ec60b8ca

View File

@ -737,6 +737,7 @@ SMESHGUI_ComputeDlg_QThreadQDialog::SMESHGUI_ComputeDlg_QThreadQDialog(QWidget
cancelButton = new QPushButton(tr("CANCEL")); cancelButton = new QPushButton(tr("CANCEL"));
cancelButton->setDefault(true); cancelButton->setDefault(true);
cancelButton->setCheckable(true);
QLabel * nbNodesName = new QLabel(tr("SMESH_MESHINFO_NODES"), this ); QLabel * nbNodesName = new QLabel(tr("SMESH_MESHINFO_NODES"), this );
QLabel * nbElemsName = new QLabel(tr("SMESH_MESHINFO_ELEMENTS"), this ); QLabel * nbElemsName = new QLabel(tr("SMESH_MESHINFO_ELEMENTS"), this );
@ -779,13 +780,13 @@ bool SMESHGUI_ComputeDlg_QThreadQDialog::result()
void SMESHGUI_ComputeDlg_QThreadQDialog::onCancel() void SMESHGUI_ComputeDlg_QThreadQDialog::onCancel()
{ {
qthread.cancel(); qthread.cancel();
cancelButton->setDown( true );
cancelButton->setText( tr("CANCELING")); cancelButton->setText( tr("CANCELING"));
cancelButton->setEnabled(false);
} }
void SMESHGUI_ComputeDlg_QThreadQDialog::timerEvent(QTimerEvent *event) void SMESHGUI_ComputeDlg_QThreadQDialog::timerEvent(QTimerEvent *event)
{ {
if ( !cancelButton->isDown() ) // not yet cancelled if ( !cancelButton->isChecked() ) // not yet cancelled
progressBar->setValue( progressBar->maximum() * qthread.getMesh()->GetComputeProgress() ); progressBar->setValue( progressBar->maximum() * qthread.getMesh()->GetComputeProgress() );
if(qthread.isFinished()) if(qthread.isFinished())