<!-- Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
<source>
- <choice id="bool_type"
+ <module_choice id="bool_type"
widget_type="radiobuttons"
buttons_dir="horizontal"
label="Operation type"
}
myButtons->button(0)->setChecked(true);
connect(myButtons, SIGNAL(buttonClicked(int)), this, SLOT(onCurrentIndexChanged(int)));
+ connect(myButtons, SIGNAL(buttonClicked(int)), this, SIGNAL(itemSelected(int)));
} else {
myLabel = new QLabel(aLabelText, this);
if (!aLabelIcon.isEmpty())
myCombo->addItems(aList);
connect(myCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onCurrentIndexChanged(int)));
+ connect(myCombo, SIGNAL(currentIndexChanged(int)), this, SIGNAL(itemSelected(int)));
}
}
bool isBlocked = myButtons->blockSignals(true);
myButtons->button(aIntAttr->value())->setChecked(true);
myButtons->blockSignals(isBlocked);
+ emit itemSelected(aIntAttr->value());
}
}
return true;
/// \return a controls list
virtual QList<QWidget*> getControls() const;
+signals:
+ void itemSelected(int);
+
protected:
/// Saves the internal parameters to the given feature
/// \return True in success
PartSet_MenuMgr.h
PartSet_WidgetSketchCreator.h
PartSet_IconFactory.h
+ PartSet_WidgetChoice.h
)
SET(PROJECT_SOURCES
#include "PartSet_MenuMgr.h"
#include "PartSet_CustomPrs.h"
#include "PartSet_IconFactory.h"
+#include "PartSet_WidgetChoice.h"
#include "PartSet_Filters.h"
#include "PartSet_FilterInfinite.h"
aWgt = new PartSet_WidgetFileSelector(theParent, aWorkshop, theWidgetApi, theParentId);
} else if (theType == "sketch_launcher") {
aWgt = new PartSet_WidgetSketchCreator(theParent, this, theWidgetApi, theParentId);
+ } else if (theType == "module_choice") {
+ aWgt = new PartSet_WidgetChoice(theParent, theWidgetApi, theParentId);
+ connect(aWgt, SIGNAL(itemSelected(int)), SLOT(onBooleanOperationChange(int)));
}
return aWgt;
}
{
return mySketchReentrantMgr->processEnter(thePreviousAttributeID);
}
+
+
+//******************************************************
+void PartSet_Module::onBooleanOperationChange(int theOperation)
+{
+ ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
+ if (!aOperation)
+ return;
+ ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
+ switch (theOperation) {
+ case 0:
+ aPanel->setWindowTitle(tr("Cut"));
+ break;
+ case 1:
+ aPanel->setWindowTitle(tr("Fuse"));
+ break;
+ case 2:
+ aPanel->setWindowTitle(tr("Common"));
+ break;
+ }
+}
/// A slot called on view window creation
void onViewCreated(ModuleBase_IViewWindow*);
+ /// A slot to change property panel title on change of boolean operation type
+ /// \param theOperation the operation type
+ void onBooleanOperationChange(int theOperation);
+
protected:
/// Register validators for this module
virtual void registerValidators();
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: PartSet_WidgetChoice.h
+// Created: 17 Nov 2015
+// Author: Vitaly Smetannikov
+
+#ifndef PartSet_WidgetChoice_H
+#define PartSet_WidgetChoice_H
+
+#include "PartSet.h"
+#include <ModuleBase_WidgetChoice.h>
+
+/**
+* \ingroup GUI
+* Implementation of a proxy of choice widget in order to geat access to it on moment
+* of creation in module
+*/
+class PARTSET_EXPORT PartSet_WidgetChoice : public ModuleBase_WidgetChoice
+{
+Q_OBJECT
+ public:
+ /// Constructor
+ /// \param theParent the parent object
+ /// \param theData the widget configuation. The attribute of the model widget is obtained from
+ /// \param theParentId is Id of a parent of the current attribute
+ PartSet_WidgetChoice(QWidget* theParent, const Config_WidgetAPI* theData,
+ const std::string& theParentId)
+ : ModuleBase_WidgetChoice(theParent, theData, theParentId) {}
+};
+
+#endif
\ No newline at end of file