Fwl: Always update action look when retreiving it.

This commit is contained in:
Jacob Støren 2015-08-18 10:47:51 +02:00
parent f8c5bbc481
commit 4606a3de8b

View File

@ -61,24 +61,29 @@ QAction* CmdFeature::action()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QAction* CmdFeature::action(QString customText) QAction* CmdFeature::action(QString customText)
{ {
QAction* action = NULL;
std::map<QString, QAction*>::iterator it; std::map<QString, QAction*>::iterator it;
it = m_customTextToActionMap.find(customText); it = m_customTextToActionMap.find(customText);
if (it != m_customTextToActionMap.end() && it->second != NULL) if (it != m_customTextToActionMap.end() && it->second != NULL)
{ {
return it->second; action = it->second;
} }
else else
{ {
QAction* action = new QAction(this); action = new QAction(this);
connect(action, SIGNAL(triggered(bool)), SLOT(actionTriggered(bool)));
m_customTextToActionMap[customText]= action;
}
this->setupActionLook(action); this->setupActionLook(action);
if (!customText.isEmpty()) if (!customText.isEmpty())
{ {
action->setText(customText); action->setText(customText);
} }
connect(action, SIGNAL(triggered(bool)), SLOT(actionTriggered(bool)));
m_customTextToActionMap[customText]= action;
return action; return action;
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------