filter: when a filter preset is selected, suggest its name on save

The goal here is to let the user edit already existing sets and
save them using their old name. This is a stop-gap measure until
we get a proper filter-set editing interface.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-09-06 23:53:31 +02:00 committed by Dirk Hohndel
parent 8f898477cb
commit d064f78608
3 changed files with 12 additions and 3 deletions

View file

@ -198,7 +198,15 @@ void FilterWidget2::updateFilter()
void FilterWidget2::on_addSetButton_clicked()
{
AddFilterPresetDialog dialog(this);
// If there is a selected item, suggest that to the user.
// Thus, if the user selects an item and modify the filter,
// they can simply overwrite the preset.
QString selectedPreset;
QModelIndexList selection = ui.presetTable->selectionModel()->selectedRows();
if (selection.size() == 1)
selectedPreset = filter_preset_name_qstring(selection[0].row());
AddFilterPresetDialog dialog(selectedPreset, this);
QString name = dialog.doit();
if (name.isEmpty())
return;