1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 * ModuleBase_ActionInfo.cpp
5 * Created on: Feb 4, 2015
9 #include <ModuleBase_ActionInfo.h>
10 #include <ModuleBase_IconFactory.h>
12 ModuleBase_ActionInfo::ModuleBase_ActionInfo()
17 ModuleBase_ActionInfo::ModuleBase_ActionInfo(const QString &theText)
22 ModuleBase_ActionInfo::ModuleBase_ActionInfo(const QIcon & theIcon, const QString &theText)
29 ModuleBase_ActionInfo::~ModuleBase_ActionInfo()
33 void ModuleBase_ActionInfo::initFrom(QAction* theAction)
35 // By convenience, QAction for a feature keeps feature's id as data (QVariant);
36 if (theAction->data().isValid()) {
37 id = theAction->data().toString();
39 checkable = theAction->isCheckable();
40 checked = theAction->isChecked();
41 enabled = theAction->isEnabled();
42 visible = theAction->isVisible();
43 icon = theAction->icon();
44 text = theAction->text();
45 iconText = theAction->iconText();
46 toolTip = theAction->toolTip();
47 // statusTip = theAction->statusTip();
48 // whatsThis = theAction->whatsThis();
49 shortcut = theAction->shortcut();
50 font = theAction->font();
53 void ModuleBase_ActionInfo::initFrom(std::shared_ptr<Config_FeatureMessage> theMessage)
55 id = QString::fromStdString(theMessage->id());
56 iconFile = QString::fromStdString(theMessage->icon());
57 if (!iconFile.isEmpty()) {
58 icon = ModuleBase_IconFactory::loadIcon(iconFile);
60 text = QString::fromStdString(theMessage->text());
61 toolTip = QString::fromStdString(theMessage->tooltip());
62 QString aShortcutStr = QString::fromStdString(theMessage->keysequence());
63 if (!aShortcutStr.isEmpty()) {
64 shortcut = QKeySequence(aShortcutStr);
66 // If feature requires PropertyPannel for input, it should be checkable
67 checkable = theMessage->isUseInput();
68 // If Feature requires modal Dialog box for input
69 modal = theMessage->isModal();
72 void ModuleBase_ActionInfo::initDefault()
84 // statusTip = QString();
85 // whatsThis = QString();
86 shortcut = QKeySequence();