//! \return string value\r
virtual QString getFeatureError(const FeaturePtr& theFeature);\r
\r
+ /// Connects or disconnects to the value changed signal of the property panel widgets\r
+ /// \param theWidget a property contol widget\r
+ /// \param isToConnect a boolean value whether connect or disconnect\r
+ virtual void connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect) {};\r
+\r
signals:\r
/// Signal which is emitted when operation is launched\r
void operationLaunched();\r
Config_Prop::Integer, SKETCH_WIDTH);
}
+void PartSet_Module::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect)
+{
+ mySketchMgr->connectToPropertyPanel(theWidget, isToConnect);
+}
+
void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation)
{
if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
/// Register properties of this module
virtual void registerProperties();
+ /// Connects or disconnects to the value changed signal of the property panel widgets
+ /// \param theWidget a property contol widget
+ /// \param isToConnect a boolean value whether connect or disconnect
+ virtual void connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect);
+
private slots:
/// Processing of vertex selected
void onVertexSelected();
}
}
-void PartSet_SketcherMgr::onValueStateChanged()
-{
- ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
- if (anActiveWidget && anActiveWidget->getValueState() != ModuleBase_ModelWidget::Stored)
- operationMgr()->onValidateOperation();
-}
-
void PartSet_SketcherMgr::onBeforeValuesChangedInPropertyPanel()
{
if (isNestedCreateOperation(getCurrentOperation()))
void PartSet_SketcherMgr::startNestedSketch(ModuleBase_Operation* theOperation)
{
- connectToPropertyPanel(true);
if (isNestedCreateOperation(theOperation) && myIsMouseOverWindow)
QApplication::setOverrideCursor(QCursor(Qt::CrossCursor));//QIcon(":pictures/button_plus.png").pixmap(20,20)));
}
void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOp)
{
- connectToPropertyPanel(false);
myIsMouseOverViewProcessed = true;
operationMgr()->onValidateOperation();
if (isNestedCreateOperation(theOp))
}
}
-void PartSet_SketcherMgr::connectToPropertyPanel(const bool isToConnect)
+void PartSet_SketcherMgr::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect)
{
- ModuleBase_IWorkshop* anIWorkshop = myModule->workshop();
- XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(anIWorkshop);
- XGUI_Workshop* aWorkshop = aConnector->workshop();
- XGUI_PropertyPanel* aPropertyPanel = aWorkshop->propertyPanel();
- if (aPropertyPanel) {
- const QList<ModuleBase_ModelWidget*>& aWidgets = aPropertyPanel->modelWidgets();
- foreach (ModuleBase_ModelWidget* aWidget, aWidgets) {
- if (isToConnect) {
- connect(aWidget, SIGNAL(beforeValuesChanged()),
+ if (isToConnect) {
+ connect(theWidget, SIGNAL(beforeValuesChanged()),
+ this, SLOT(onBeforeValuesChangedInPropertyPanel()));
+ connect(theWidget, SIGNAL(valuesChanged()), this, SLOT(onValuesChangedInPropertyPanel()));
+ connect(theWidget, SIGNAL(afterValuesChanged()),
+ this, SLOT(onAfterValuesChangedInPropertyPanel()));
+ }
+ else {
+ disconnect(theWidget, SIGNAL(beforeValuesChanged()),
this, SLOT(onBeforeValuesChangedInPropertyPanel()));
- connect(aWidget, SIGNAL(valueStateChanged()),
- this, SLOT(onValueStateChanged()));
- connect(aWidget, SIGNAL(valuesChanged()), this, SLOT(onValuesChangedInPropertyPanel()));
- connect(aWidget, SIGNAL(afterValuesChanged()),
+ disconnect(theWidget, SIGNAL(valuesChanged()), this, SLOT(onValuesChangedInPropertyPanel()));
+ disconnect(theWidget, SIGNAL(afterValuesChanged()),
this, SLOT(onAfterValuesChangedInPropertyPanel()));
- }
- else {
- disconnect(aWidget, SIGNAL(beforeValuesChanged()),
- this, SLOT(onBeforeValuesChangedInPropertyPanel()));
- disconnect(aWidget, SIGNAL(valuesChanged()), this, SLOT(onValuesChangedInPropertyPanel()));
- disconnect(aWidget, SIGNAL(afterValuesChanged()),
- this, SLOT(onAfterValuesChangedInPropertyPanel()));
- }
- }
}
}
/// \param theModes a list of modes
static void sketchSelectionModes(QIntList& theModes);
+ /// Connects or disconnects to the value changed signal of the property panel widgets
+ /// \param theWidget a property contol widget
+ /// \param isToConnect a boolean value whether connect or disconnect
+ void connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect);
+
public slots:
/// Process sketch plane selected event
void onPlaneSelected(const std::shared_ptr<GeomAPI_Pln>& thePln);
/// Process the leave mouse of the view port. If the current operation is a create of
/// a nested sketch feature, it hides the feature in the viewer
void onLeaveViewPort();
-
- /// Validates the operation. Apply button is disabled if the widget value is in Modified state
- void onValueStateChanged();
/// Listens to the value changed signal and display the current operation feature
void onBeforeValuesChangedInPropertyPanel();
/// Listens to the signal about values are to be changed in the property panel
const FeatureToSelectionMap& theSelection,
SelectMgr_IndexedMapOfOwner& anOwnersToSelect);
- /// Connects or disconnects to the value changed signal of the property panel widgets
- /// \param isToConnect a boolean value whether connect or disconnect
- void connectToPropertyPanel(const bool isToConnect);
-
/// Returns true if the created feature is visible
/// \param
bool isVisibleCreatedFeature() const;
}
updateCommandStatus();
+ connectToPropertyPanel(true);
myModule->operationStarted(aFOperation);
// the objects of the current operation should be deactivated
hidePropertyPanel();
myPropertyPanel->cleanContent();
+ connectToPropertyPanel(false);
myModule->operationStopped(aFOperation);
// the deactivated objects of the current operation should be activated back.
myErrorMgr->setPropertyPanel(myPropertyPanel);
}
+void XGUI_Workshop::connectToPropertyPanel(const bool isToConnect)
+{
+ XGUI_PropertyPanel* aPropertyPanel = propertyPanel();
+ if (aPropertyPanel) {
+ const QList<ModuleBase_ModelWidget*>& aWidgets = aPropertyPanel->modelWidgets();
+ foreach (ModuleBase_ModelWidget* aWidget, aWidgets) {
+ myModule->connectToPropertyPanel(aWidget, isToConnect);
+ if (isToConnect) {
+ connect(aWidget, SIGNAL(valueStateChanged()), this, SLOT(onValueStateChanged()));
+ }
+ else {
+ disconnect(aWidget, SIGNAL(valueStateChanged()), this, SLOT(onValueStateChanged()));
+ }
+ }
+ }
+}
+
/*
* Saves document with given name.
*/
}
}
+//******************************************************
+void XGUI_Workshop::onValueStateChanged()
+{
+ ModuleBase_ModelWidget* anActiveWidget = 0;
+ ModuleBase_Operation* anOperation = myOperationMgr->currentOperation();
+ if (anOperation) {
+ ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel();
+ if (aPanel)
+ anActiveWidget = aPanel->activeWidget();
+ }
+ if (anActiveWidget && anActiveWidget->getValueState() != ModuleBase_ModelWidget::Stored)
+ operationMgr()->onValidateOperation();
+}
+
//******************************************************
ModuleBase_IModule* XGUI_Workshop::loadModule(const QString& theModule)
{
/// Rebuild data tree
void onRebuild();
+ /// Validates the operation. Apply button is disabled if the widget value is in Modified state
+ void onValueStateChanged();
+
/// Open preferences dialog box
void onPreferences();
/// \param theOperation an operation
void setPropertyPanel(ModuleBase_Operation* theOperation);
+ /// Connects or disconnects to the value changed signal of the property panel widgets
+ /// \param isToConnect a boolean value whether connect or disconnect
+ void connectToPropertyPanel(const bool isToConnect);
+
private:
/// Display all results
//void displayAllResults();