diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-06-20 22:32:01 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-09-29 16:13:03 -0700 |
commit | 68fffc267212470f6d5eb218744b29a851f61cc2 (patch) | |
tree | 1cd6f3323b20ad08355edd22cab1b1bff2c4723f /desktop-widgets | |
parent | 1fcf4f891d9530639c82cc72ad748b23b57a44a1 (diff) | |
download | subsurface-68fffc267212470f6d5eb218744b29a851f61cc2.tar.gz |
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 <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/simplewidgets.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
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 <QDesktopServices> #include <QToolTip> #include <QClipboard> +#include <QCompleter> #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) |