Fix empty hotkeys being loaded

This commit is contained in:
ArsenArsen 2017-07-05 15:30:50 +02:00
parent 7d5be857ff
commit 159720d9fa

View File

@ -28,9 +28,13 @@ void hotkeying::load(QString seqName, std::function<void()> func, QString def) {
QString name = seqName; QString name = seqName;
name.prepend("hotkey_"); name.prepend("hotkey_");
if (hotkeys.contains(seqName)) return; if (hotkeys.contains(seqName)) return;
if (settings::settings().contains(name)) if (settings::settings().contains(name)) {
h = new QHotkey(QKeySequence(settings::settings().value(name).toString()), true); QString k = settings::settings().value(name).toString();
else if (!k.isEmpty())
h = new QHotkey(QKeySequence(settings::settings().value(k).toString()), true);
else
h = new QHotkey(def.isNull() ? "" : def, true);
} else
h = new QHotkey(def.isNull() ? "" : def, true); h = new QHotkey(def.isNull() ? "" : def, true);
QObject::connect(h, &QHotkey::activated, func); QObject::connect(h, &QHotkey::activated, func);
hotkeys.insert(seqName, h); hotkeys.insert(seqName, h);