]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1278 In the sketch the creation line is not functional when I check the box...
authornds <nds@opencascade.com>
Tue, 29 Mar 2016 06:18:35 +0000 (09:18 +0300)
committernds <nds@opencascade.com>
Tue, 29 Mar 2016 06:18:35 +0000 (09:18 +0300)
src/ModuleBase/ModuleBase_WidgetBoolValue.h
src/XGUI/XGUI_PropertyPanel.cpp
src/XGUI/XGUI_PropertyPanel.h

index 082e54eecec51e43e3dd96443960b4981484053f..58561d35eeb2f07689a86acdb453853699681238 100644 (file)
@@ -29,6 +29,8 @@ Q_OBJECT
 
   virtual ~ModuleBase_WidgetBoolValue();
 
+  virtual bool canSetValue() const { return false; };
+
   virtual QList<QWidget*> getControls() const;
 
   virtual void setHighlighted(bool isHighlighted);
index 14add657fe2911ac3fa0ae2bf0c861a3d8aba947..5930c5e9f864373b331c38340b4e55ba5b07f1c7 100755 (executable)
@@ -118,7 +118,7 @@ void XGUI_PropertyPanel::setModelWidgets(const QList<ModuleBase_ModelWidget*>& 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
index 958d0ae5908853a81ea15298443b8095c768202f..a4df2a0727c36602676b90634d88f35708bc2452 100644 (file)
@@ -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: