diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/configuration/configuration.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/configuration/configuration.h b/lib/configuration/configuration.h index 162fbd7..cce00bd 100644 --- a/lib/configuration/configuration.h +++ b/lib/configuration/configuration.h @@ -94,11 +94,19 @@ public: { Q_CHECK_PTR(action); - action->setShortcut(QKeySequence::fromString(value<QString>(name).value())); - connect(this, &Configuration::settingChanged, action, [=](const std::string &path, const QString &value) { - if(path == name) - action->setShortcut(QKeySequence::fromString(value)); - }); + const auto shortcutText = this->value<QString>(name); + if(shortcutText) { + const QString tooltip = action->toolTip(); + action->setShortcut(QKeySequence::fromString(shortcutText.value())); + action->setToolTip(QString("%1 (%2)").arg(tooltip, shortcutText.value())); + + connect(this, &Configuration::settingChanged, action, [=](const std::string &path, const QString &value) { + if(path == name) { + action->setShortcut(QKeySequence::fromString(value)); + action->setToolTip(QString("%1 (%2)").arg(tooltip, value)); + } + }); + } } QHash<QString, QString> section(const std::string &prefix) const; |