From b41d623d6a45dbaff976851453315e484fdef3f9 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 15 Nov 2021 21:40:41 +0100 Subject: [PATCH] GUI: language dialog: auto-focus first control on mode switch --- NEWS.md | 8 ++++++++ src/mkvtoolnix-gui/util/language_dialog.cpp | 11 ++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index 9d064653c..795207588 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,11 @@ +# Version ? + +## New features and enhancements + +* MKVToolNix GUI: language dialog: when the user switches between the two edit + modes, the mode's corresponding first control is automatically focussed. + + # Version 63.0.0 "Everything" 2021-11-14 ## New features and enhancements diff --git a/src/mkvtoolnix-gui/util/language_dialog.cpp b/src/mkvtoolnix-gui/util/language_dialog.cpp index 9d6546005..d92fb7ca3 100644 --- a/src/mkvtoolnix-gui/util/language_dialog.cpp +++ b/src/mkvtoolnix-gui/util/language_dialog.cpp @@ -89,14 +89,11 @@ LanguageDialog::LanguageDialog(QWidget *parent) p.ui->setupUi(this); - if (Settings::get().m_bcp47LanguageEditingMode == Settings::BCP47LanguageEditingMode::FreeForm) { + if (Settings::get().m_bcp47LanguageEditingMode == Settings::BCP47LanguageEditingMode::FreeForm) p.ui->rbFreeForm->setChecked(true); - p.ui->leFreeForm->setFocus(); - } else { + else p.ui->rbComponentSelection->setChecked(true); - p.ui->cbLanguage->setFocus(); - } createInitialComponentWidgetList(); createGridLayoutFromComponentWidgetList(); @@ -341,6 +338,8 @@ LanguageDialog::setupFreeFormAndComponentControls() { connect(p.ui->leFreeForm, &QLineEdit::textChanged, this, &LanguageDialog::updateFromFreeForm); + p.ui->leFreeForm->setFocus(); + } else { p.ui->leFreeForm->setEnabled(false); Util::enableChildren(p.ui->sawComponents, true); @@ -349,6 +348,8 @@ LanguageDialog::setupFreeFormAndComponentControls() { for (auto widget : componentWidgets) connectComponentWidgetChange(widget); + + p.ui->cbLanguage->setFocus(); } maybeEnableAddExtendedSubtagButton();