diff options
author | Petr Mrázek <peterix@gmail.com> | 2016-08-17 23:09:33 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2016-08-17 23:09:33 +0200 |
commit | 9aff21c1810f366f599fc5d35dfd3d7bc216f759 (patch) | |
tree | 0bb69214f13e4c4beef4c2afc9ae99bb889d33d8 | |
parent | ec05ca2775eec75ce2248b3b575f030c198ff2ee (diff) | |
download | MultiMC-9aff21c1810f366f599fc5d35dfd3d7bc216f759.tar MultiMC-9aff21c1810f366f599fc5d35dfd3d7bc216f759.tar.gz MultiMC-9aff21c1810f366f599fc5d35dfd3d7bc216f759.tar.lz MultiMC-9aff21c1810f366f599fc5d35dfd3d7bc216f759.tar.xz MultiMC-9aff21c1810f366f599fc5d35dfd3d7bc216f759.zip |
NOISSUE make progress dialog abort button resistant to accidental key presses
-rw-r--r-- | application/dialogs/ProgressDialog.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/application/dialogs/ProgressDialog.cpp b/application/dialogs/ProgressDialog.cpp index 5d7c7968..3e9b604a 100644 --- a/application/dialogs/ProgressDialog.cpp +++ b/application/dialogs/ProgressDialog.cpp @@ -31,6 +31,9 @@ ProgressDialog::ProgressDialog(QWidget *parent) : QDialog(parent), ui(new Ui::Pr 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->setVisible(present); ui->skipButton->setText(label); @@ -159,8 +162,22 @@ void ProgressDialog::changeProgress(qint64 current, qint64 total) void ProgressDialog::keyPressEvent(QKeyEvent *e) { - if (e->key() == Qt::Key_Escape) - return; + if(ui->skipButton->isVisible()) + { + if (e->key() == Qt::Key_Escape) + { + on_skipButton_clicked(true); + 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); } |