diff --git a/src/library/dlgtrackinfo.cpp b/src/library/dlgtrackinfo.cpp index 55797e391700..3c7d36939168 100644 --- a/src/library/dlgtrackinfo.cpp +++ b/src/library/dlgtrackinfo.cpp @@ -77,6 +77,7 @@ void DlgTrackInfo::init() { btnPrev->hide(); } + // QDialog buttons connect(btnApply, &QPushButton::clicked, this, @@ -92,6 +93,7 @@ void DlgTrackInfo::init() { this, &DlgTrackInfo::slotCancel); + // BPM edit buttons connect(bpmDouble, &QPushButton::clicked, this, @@ -203,6 +205,7 @@ void DlgTrackInfo::init() { txtTrackNumber->text().trimmed()); }); + // Import and file browser buttons connect(btnImportMetadataFromFile, &QPushButton::clicked, this, @@ -218,6 +221,7 @@ void DlgTrackInfo::init() { this, &DlgTrackInfo::slotOpenInFileBrowser); + // Cover art CoverArtCache* pCache = CoverArtCache::instance(); if (pCache) { connect(pCache, @@ -483,6 +487,20 @@ void DlgTrackInfo::saveTrack() { return; } + // In case Apply is triggered by hotkey AND a QLineEdit with pending changes + // is focused AND the user did not hit Enter to finish editing, + // the content of that focused line edit would be reset to the last confirmed state. + // This hack emits the editingFinished() signal for the focused QLineEdit. + if (this == QApplication::activeWindow()) { + auto focusWidget = QApplication::focusWidget(); + if (focusWidget) { + QLineEdit* focusedLineEdit = static_cast(focusWidget); + if (focusedLineEdit) { + emit focusedLineEdit->editingFinished(); + } + } + } + // First, disconnect the track changed signal. Otherwise we signal ourselves // and repopulate all these fields. const QSignalBlocker signalBlocker(this);