NOISSUE make progress dialog abort button resistant to accidental key presses
This commit is contained in:
parent
ec05ca2775
commit
9aff21c181
@ -31,6 +31,9 @@ ProgressDialog::ProgressDialog(QWidget *parent) : QDialog(parent), ui(new Ui::Pr
|
|||||||
|
|
||||||
void ProgressDialog::setSkipButton(bool present, QString label)
|
void ProgressDialog::setSkipButton(bool present, QString label)
|
||||||
{
|
{
|
||||||
|
ui->skipButton->setAutoDefault(false);
|
||||||
|
ui->skipButton->setDefault(false);
|
||||||
|
ui->skipButton->setFocusPolicy(Qt::ClickFocus);
|
||||||
ui->skipButton->setEnabled(present);
|
ui->skipButton->setEnabled(present);
|
||||||
ui->skipButton->setVisible(present);
|
ui->skipButton->setVisible(present);
|
||||||
ui->skipButton->setText(label);
|
ui->skipButton->setText(label);
|
||||||
@ -158,9 +161,23 @@ void ProgressDialog::changeProgress(qint64 current, qint64 total)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ProgressDialog::keyPressEvent(QKeyEvent *e)
|
void ProgressDialog::keyPressEvent(QKeyEvent *e)
|
||||||
|
{
|
||||||
|
if(ui->skipButton->isVisible())
|
||||||
{
|
{
|
||||||
if (e->key() == Qt::Key_Escape)
|
if (e->key() == Qt::Key_Escape)
|
||||||
|
{
|
||||||
|
on_skipButton_clicked(true);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
else if(e->key() == Qt::Key_Tab)
|
||||||
|
{
|
||||||
|
ui->skipButton->setFocusPolicy(Qt::StrongFocus);
|
||||||
|
ui->skipButton->setFocus();
|
||||||
|
ui->skipButton->setAutoDefault(true);
|
||||||
|
ui->skipButton->setDefault(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
QDialog::keyPressEvent(e);
|
QDialog::keyPressEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user