From: nds Date: Tue, 29 Mar 2016 06:18:35 +0000 (+0300) Subject: Issue #1278 In the sketch the creation line is not functional when I check the box... X-Git-Tag: V_2.3.0~366 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c8f77e4026552d0bd9efa0a2ee3ab32747840df6;p=modules%2Fshaper.git Issue #1278 In the sketch the creation line is not functional when I check the box "Auxiliary": do not set focus to the check box, the value is applyed because this control click is connected to the model modification. --- diff --git a/src/ModuleBase/ModuleBase_WidgetBoolValue.h b/src/ModuleBase/ModuleBase_WidgetBoolValue.h index 082e54eec..58561d35e 100644 --- a/src/ModuleBase/ModuleBase_WidgetBoolValue.h +++ b/src/ModuleBase/ModuleBase_WidgetBoolValue.h @@ -29,6 +29,8 @@ Q_OBJECT virtual ~ModuleBase_WidgetBoolValue(); + virtual bool canSetValue() const { return false; }; + virtual QList getControls() const; virtual void setHighlighted(bool isHighlighted); diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index 14add657f..5930c5e9f 100755 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -118,7 +118,7 @@ void XGUI_PropertyPanel::setModelWidgets(const QList& t if (theWidgets.empty()) return; foreach (ModuleBase_ModelWidget* aWidget, theWidgets) { connect(aWidget, SIGNAL(focusInWidget(ModuleBase_ModelWidget*)), - this, SLOT(activateWidget(ModuleBase_ModelWidget*))); + this, SLOT(onFocusInWidget(ModuleBase_ModelWidget*))); connect(aWidget, SIGNAL(focusOutWidget(ModuleBase_ModelWidget*)), this, SLOT(onActivateNextWidget(ModuleBase_ModelWidget*))); connect(aWidget, SIGNAL(keyReleased(QObject*, QKeyEvent*)), @@ -162,6 +162,12 @@ void XGUI_PropertyPanel::activateNextWidget(ModuleBase_ModelWidget* theWidget) activateNextWidget(theWidget, false); } +void XGUI_PropertyPanel::onFocusInWidget(ModuleBase_ModelWidget* theWidget) +{ + if (theWidget->canSetValue()) + activateWidget(theWidget); +} + void XGUI_PropertyPanel::onActivateNextWidget(ModuleBase_ModelWidget* theWidget) { // this slot happens when some widget lost focus, the next widget which accepts the focus diff --git a/src/XGUI/XGUI_PropertyPanel.h b/src/XGUI/XGUI_PropertyPanel.h index 958d0ae59..a4df2a072 100644 --- a/src/XGUI/XGUI_PropertyPanel.h +++ b/src/XGUI/XGUI_PropertyPanel.h @@ -120,6 +120,10 @@ public slots: */ virtual void activateWidget(ModuleBase_ModelWidget* theWidget, const bool theEmitSignal = true); + /// Activates the parameter widget if it can accept focus + /// \param theWidget a widget where focus in event happened + void onFocusInWidget(ModuleBase_ModelWidget* theWidget); + void onActivateNextWidget(ModuleBase_ModelWidget* theWidget); signals: