From 46a84da571d51b135e16ac4731baaf67c552d791 Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Sun, 18 Aug 2024 01:00:18 +0200 Subject: [PATCH] Gui: Fix issue with missing icons in sketcher This boiled down to conflict of using `data` attribute of the QAction in ActionGroup and ToolBarManager. I reworked ActionGroup here to not use the data attribute but this is not a proper solution - but it should be working well enough. Proper solution would be to leave the data for the specific usecases (like index) and store the command name in some other place. It would however require us to subclass the QAction which is not something that should be done so late in the release cycle. --- src/Gui/Action.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/Gui/Action.cpp b/src/Gui/Action.cpp index 3010d1cd97..4665f3160e 100644 --- a/src/Gui/Action.cpp +++ b/src/Gui/Action.cpp @@ -538,18 +538,12 @@ bool ActionGroup::doesRememberLast() const QAction* ActionGroup::addAction(QAction* action) { - int index = groupAction()->actions().size(); - action = groupAction()->addAction(action); - action->setData(QVariant(index)); - return action; + return groupAction()->addAction(action); } QAction* ActionGroup::addAction(const QString& text) { - int index = groupAction()->actions().size(); - QAction* action = groupAction()->addAction(text); - action->setData(QVariant(index)); - return action; + return groupAction()->addAction(text); } QList ActionGroup::actions() const @@ -559,8 +553,9 @@ QList ActionGroup::actions() const int ActionGroup::checkedAction() const { - QAction* checked = groupAction()->checkedAction(); - return checked ? checked->data().toInt() : -1; + auto checked = groupAction()->checkedAction(); + + return actions().indexOf(checked); } void ActionGroup::setCheckedAction(int index)