From 101b5b7cee0b1bc51ea947a6316f6cecce4b7eb8 Mon Sep 17 00:00:00 2001 From: Pengfei Date: Tue, 31 Aug 2021 22:50:05 +0800 Subject: [PATCH] Minor improvement to UX --- src/frontend/select_nand_dialog.cpp | 5 +++-- src/frontend/select_nand_dialog.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/frontend/select_nand_dialog.cpp b/src/frontend/select_nand_dialog.cpp index 269295a..a619441 100644 --- a/src/frontend/select_nand_dialog.cpp +++ b/src/frontend/select_nand_dialog.cpp @@ -28,16 +28,17 @@ SelectNandDialog::SelectNandDialog(QWidget* parent, } QRadioButton* button = new QRadioButton(display_name); + if (i == 0) { // Select one by default + button->setChecked(true); + } connect(button, &QRadioButton::toggled, this, [this, i](bool checked) { if (checked) { - ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); result = i; } }); ui->contentLayout->addWidget(button); } - ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); } diff --git a/src/frontend/select_nand_dialog.h b/src/frontend/select_nand_dialog.h index 69d7887..1436bfc 100644 --- a/src/frontend/select_nand_dialog.h +++ b/src/frontend/select_nand_dialog.h @@ -23,5 +23,5 @@ private: std::unique_ptr ui; const std::vector& nands; - int result = -1; + int result = 0; };