From d0f082b9ae908478fc650472c1cb9743d84a2b59 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 4 Nov 2024 11:54:30 +0100 Subject: [PATCH] Find: Fix reading settings It was not possible to go back to the default filter after other filters got added to the list. Saving and restoring the current filter was not symmetric for the default case: When writing, the current value was not written if it was default, when reading the current value, it was set to the first value in the list if not set in the settings, instead of the default. Fixes: QTCREATORBUG-31676 Change-Id: I5cde924f56744f9142b5cc52b51a9f08d06b3d64 Reviewed-by: David Schulz --- src/plugins/texteditor/basefilefind.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp index dc794b86ade..15e7f44a256 100644 --- a/src/plugins/texteditor/basefilefind.cpp +++ b/src/plugins/texteditor/basefilefind.cpp @@ -489,8 +489,7 @@ void BaseFileFind::readCommonSettings( const QStringList filters = filterSetting.isEmpty() ? QStringList(defaultFilter) : filterSetting; const QVariant currentFilter = s.value("currentFilter"); - d->m_filterSetting = currentFilter.isValid() ? currentFilter.toString() - : filters.first(); + d->m_filterSetting = currentFilter.isValid() ? currentFilter.toString() : defaultFilter; d->m_filterStrings.setStringList(toNativeSeparators(filters)); if (d->m_filterCombo) syncComboWithSettings(d->m_filterCombo, d->m_filterSetting);