filter: don't escape '&' in filter-preset menu

When constructing an action, '&' is used as the keyboard shortcut
marker. Since this mangles preset names, use the setIconText()
function of the action instead.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-11-07 21:06:54 +01:00 committed by Dirk Hohndel
parent 5caac4c480
commit 41c0fb4039

View file

@ -77,7 +77,10 @@ void FilterWidget::updatePresetMenu()
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
QModelIndex idx = model->index(i, FilterPresetModel::NAME); QModelIndex idx = model->index(i, FilterPresetModel::NAME);
QString name = model->data(idx, Qt::DisplayRole).value<QString>(); QString name = model->data(idx, Qt::DisplayRole).value<QString>();
loadFilterPresetMenu->addAction(name, [this,i]() { selectPreset(i); }); QAction *action = new QAction(loadFilterPresetMenu.get());
action->setIconText(name);
connect(action, &QAction::triggered, [this,i]() { selectPreset(i); });
loadFilterPresetMenu->addAction(action);
} }
ui.loadSetButton->setMenu(loadFilterPresetMenu.get()); ui.loadSetButton->setMenu(loadFilterPresetMenu.get());
} }