From 68fffc267212470f6d5eb218744b29a851f61cc2 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 20 Jun 2020 22:32:01 +0200 Subject: filter: add completer for save-filter-preset dialog Thus, the user can easily overwrite already existing settings. Not perfect, but the easy solution for now. Signed-off-by: Berthold Stoeger --- desktop-widgets/simplewidgets.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'desktop-widgets/simplewidgets.cpp') diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index 153d3239e..bbce159b6 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include "core/file.h" #include "core/filterpreset.h" @@ -486,6 +487,16 @@ AddFilterPresetDialog::AddFilterPresetDialog(QWidget *parent) connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &AddFilterPresetDialog::accept); connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &AddFilterPresetDialog::reject); nameChanged(ui.name->text()); + + // Create a completer so that the user can easily overwrite existing presets. + QStringList presets; + int count = filter_presets_count(); + presets.reserve(count); + for (int i = 0; i < count; ++i) + presets.push_back(filter_preset_name_qstring(i)); + QCompleter *completer = new QCompleter(presets, this); + completer->setCaseSensitivity(Qt::CaseInsensitive); + ui.name->setCompleter(completer); } void AddFilterPresetDialog::nameChanged(const QString &text) -- cgit v1.2.3-70-g09d2