From 02e0af2f1d00326dd75df30bc60fbba35aea3a41 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Mon, 7 Mar 2022 13:02:42 +0800 Subject: [PATCH] Gui: fix GroupCommand icon setup --- src/Gui/Command.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index 34c4d40c66..291cc215d4 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -1086,10 +1086,12 @@ void GroupCommand::setup(Action *pcAction) { if(idx>=0 && idx<(int)cmds.size() && cmds[idx].first) { auto cmd = cmds[idx].first; pcAction->setText(QCoreApplication::translate(className(), getMenuText())); + QIcon icon; if (auto childAction = cmd->getAction()) - pcAction->setIcon(childAction->icon()); - else - pcAction->setIcon(BitmapFactory().iconFromTheme(cmd->getPixmap())); + icon = childAction->icon(); + if (icon.isNull()) + icon = BitmapFactory().iconFromTheme(cmd->getPixmap()); + pcAction->setIcon(icon); const char *context = dynamic_cast(cmd) ? cmd->getName() : cmd->className(); const char *tooltip = cmd->getToolTipText(); const char *statustip = cmd->getStatusTip();