class PartSetPlugin_Duplicate : public PartSetPlugin_Part
{
public:
+ /// Duplicate kind
+ inline static const std::string& ID()
+ {
+ static const std::string MY_DUPLICATE_KIND("Duplicate");
+ return MY_DUPLICATE_KIND;
+ }
+ /// Returns the kind of a feature
+ PARTSETPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = PartSetPlugin_Duplicate::ID();
+ return MY_KIND;
+ }
+
/// the reference to copy: reference to the attribute
inline static const std::string& ORIGIN_REF()
{
if (theFeatureID == PartSetPlugin_Part::ID()) {
return FeaturePtr(new PartSetPlugin_Part);
}
- if (theFeatureID == "duplicate") {
+ if (theFeatureID == PartSetPlugin_Duplicate::ID()) {
return FeaturePtr(new PartSetPlugin_Duplicate);
}
- if (theFeatureID == "remove") {
+ if (theFeatureID == PartSetPlugin_Remove::ID()) {
return FeaturePtr(new PartSetPlugin_Remove);
}
// feature of such kind is not found
<workbench id="Part">
<group id="Operations">
<feature id="Part" title="New part" tooltip="Create a new part" icon=":pictures/part_ico.png"/>
- <feature id="duplicate" title="Duplicate" tooltip="Duplicate selected part" icon=":icons/duplicate.png"/>
- <feature id="remove" title="Remove part" tooltip="Remove active part" icon=":icons/remove.png"/>
+ <feature id="Duplicate" title="Duplicate" tooltip="Duplicate selected part" icon=":icons/duplicate.png"/>
+ <feature id="Remove" title="Remove part" tooltip="Remove active part" icon=":icons/remove.png"/>
</group>
</workbench>
</plugin>
void XGUI_ActionsMgr::setActionChecked(const QString& theId, const bool theChecked)
{
- QAction* anAction = myActions[theId];
- if (anAction && anAction->isCheckable()) {
- anAction->setChecked(theChecked);
+ if (myActions.contains(theId)) {
+ QAction* anAction = myActions[theId];
+ if (anAction->isCheckable()) {
+ anAction->setChecked(theChecked);
+ }
}
}
QString aCmdDocKind;
if(aCmd) {
aCmdDocKind = aCmd->documentKind();
- } else if (eachAction) {
+ } else {
QString aId = eachAction->data().toString();
if (!aId.isEmpty()) {
aCmdDocKind = aWorkshop->salomeConnector()->documentKind(aId);
void XGUI_ActionsMgr::setActionEnabled(const QString& theId, const bool theEnabled)
{
- QAction* anAction = myActions[theId];
- if (anAction) {
- anAction->setEnabled(theEnabled);
+ if (myActions.contains(theId)) {
+ myActions[theId]->setEnabled(theEnabled);
}
}