forked from qt-creator/qt-creator
Find: Fix wrong target of (replace) next/previous actions.
They were always triggered on the find support that had the find tool bar, even if the focus moved to a different one and even if the find tool bar was not visible. Task-number: QTCREATORBUG-11587 Change-Id: Ica7ef6275dc8a7e0e8b974c2796651c9ca7809a6 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -421,18 +421,22 @@ bool Action::hasAttribute(Command::CommandAttribute attr) const
|
||||
}
|
||||
|
||||
|
||||
void Command::augmentActionWithShortcutToolTip(QAction *a) const
|
||||
{
|
||||
a->setToolTip(stringWithAppendedShortcut(a->text()));
|
||||
QObject::connect(this, &Core::Command::keySequenceChanged, a, [this, a]() {
|
||||
a->setToolTip(stringWithAppendedShortcut(a->text()));
|
||||
});
|
||||
QObject::connect(a, &QAction::changed, this, [this, a]() {
|
||||
a->setToolTip(stringWithAppendedShortcut(a->text()));
|
||||
});
|
||||
}
|
||||
|
||||
QToolButton *Command::toolButtonWithAppendedShortcut(QAction *action, Command *cmd)
|
||||
{
|
||||
QToolButton *button = new QToolButton;
|
||||
button->setDefaultAction(action);
|
||||
if (cmd) {
|
||||
action->setToolTip(cmd->stringWithAppendedShortcut(action->text()));
|
||||
QObject::connect(cmd, &Core::Command::keySequenceChanged, action, [cmd, action]() {
|
||||
action->setToolTip(cmd->stringWithAppendedShortcut(action->text()));
|
||||
});
|
||||
QObject::connect(action, &QAction::changed, cmd, [cmd, action]() {
|
||||
action->setToolTip(cmd->stringWithAppendedShortcut(action->text()));
|
||||
});
|
||||
}
|
||||
if (cmd)
|
||||
cmd->augmentActionWithShortcutToolTip(action);
|
||||
return button;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user