Fix: Update tooltip for grouped commands (#24043)

When a command is part of a toolbar group, the tooltip for the group's button was not correctly updated with the shortcut of the selected command. This was happening because the tooltip generation was using the shortcut of the group itself, not the selected child command.

This commit fixes the issue by ensuring that the tooltip of the group action is updated with the full tooltip of the child action, which already contains the correct shortcut information. This is done in both 'ActionGroup::onActivated' (for when a new tool is selected) and 'ActionGroup::setCheckedAction' (for the initial default tool).
This commit is contained in:
matt-taylor-git
2025-09-19 11:20:39 -04:00
committed by GitHub
parent d8677a99e5
commit ce7a1e64f0

View File

@@ -565,7 +565,7 @@ void ActionGroup::setCheckedAction(int index)
this->setIcon(act->icon());
if (!this->_isMode) {
this->setToolTip(act->toolTip(), act->text());
this->action()->setToolTip(act->toolTip());
}
this->setProperty("defaultAction", QVariant(index));
}
@@ -594,7 +594,7 @@ void ActionGroup::onActivated (QAction* act)
this->setIcon(act->icon());
if (!this->_isMode) {
this->setToolTip(act->toolTip(), act->text());
this->action()->setToolTip(act->toolTip());
}
this->setProperty("defaultAction", QVariant(index));
command()->invoke(index, Command::TriggerChildAction);