From 4606a3de8b23227f426710fa374e488b7c83913c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Tue, 18 Aug 2015 10:47:51 +0200 Subject: [PATCH] Fwl: Always update action look when retreiving it. --- Fwk/AppFwk/cafCommand/cafCmdFeature.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Fwk/AppFwk/cafCommand/cafCmdFeature.cpp b/Fwk/AppFwk/cafCommand/cafCmdFeature.cpp index 5ef2da6788..a7fa7f18e1 100644 --- a/Fwk/AppFwk/cafCommand/cafCmdFeature.cpp +++ b/Fwk/AppFwk/cafCommand/cafCmdFeature.cpp @@ -61,24 +61,29 @@ QAction* CmdFeature::action() //-------------------------------------------------------------------------------------------------- QAction* CmdFeature::action(QString customText) { + QAction* action = NULL; + std::map::iterator it; it = m_customTextToActionMap.find(customText); + if (it != m_customTextToActionMap.end() && it->second != NULL) { - return it->second; + action = it->second; } else { - QAction* action = new QAction(this); - this->setupActionLook(action); - if (!customText.isEmpty()) - { - action->setText(customText); - } + action = new QAction(this); connect(action, SIGNAL(triggered(bool)), SLOT(actionTriggered(bool))); m_customTextToActionMap[customText]= action; - return action; } + + this->setupActionLook(action); + if (!customText.isEmpty()) + { + action->setText(customText); + } + + return action; } //--------------------------------------------------------------------------------------------------