Minor improvement to UX

This commit is contained in:
Pengfei
2021-08-31 22:50:05 +08:00
parent bfb7072013
commit 101b5b7cee
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -28,16 +28,17 @@ SelectNandDialog::SelectNandDialog(QWidget* parent,
} }
QRadioButton* button = new QRadioButton(display_name); 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) { connect(button, &QRadioButton::toggled, this, [this, i](bool checked) {
if (checked) { if (checked) {
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
result = i; result = i;
} }
}); });
ui->contentLayout->addWidget(button); ui->contentLayout->addWidget(button);
} }
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
} }
+1 -1
View File
@@ -23,5 +23,5 @@ private:
std::unique_ptr<Ui::SelectNandDialog> ui; std::unique_ptr<Ui::SelectNandDialog> ui;
const std::vector<Core::Config::NandConfig>& nands; const std::vector<Core::Config::NandConfig>& nands;
int result = -1; int result = 0;
}; };