]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Simplification of the code
authornds <nds@opencascade.com>
Fri, 30 Oct 2015 08:44:07 +0000 (11:44 +0300)
committernds <nds@opencascade.com>
Fri, 30 Oct 2015 08:44:07 +0000 (11:44 +0300)
src/ModuleBase/ModuleBase_DoubleSpinBox.cpp
src/ModuleBase/ModuleBase_DoubleSpinBox.h
src/ModuleBase/ModuleBase_OperationFeature.cpp
src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp
src/ModuleBase/ModuleBase_WidgetExprEditor.cpp
src/ModuleBase/ModuleBase_WidgetExprEditor.h
src/ModuleBase/ModuleBase_WidgetIntValue.cpp
src/PartSet/PartSet_WidgetPoint2d.cpp
src/PartSet/PartSet_WidgetPoint2dDistance.cpp
src/PartSet/PartSet_WidgetPoint2dDistance.h

index 5cd665673aebb874fb3eefa46de2897a0997c91f..94387b2eca027b7ad9b197b2694d13a0121ab9c0 100644 (file)
@@ -80,7 +80,6 @@ ModuleBase_DoubleSpinBox::ModuleBase_DoubleSpinBox(QWidget* theParent, int thePr
           SLOT(onTextChanged( const QString& )));
 
   connect(this, SIGNAL(valueChanged(const QString&)), this, SLOT(onValueChanged(const QString&)));
-  //connect(this, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
 }
 
 /*!
@@ -345,11 +344,6 @@ void ModuleBase_DoubleSpinBox::onValueChanged(const QString& theValue)
   myIsModified = true;
 }
 
-void ModuleBase_DoubleSpinBox::onEditingFinished()
-{
-  //myIsModified = false;
-}
-
 bool ModuleBase_DoubleSpinBox::isModified() const
 {
   return myIsModified;
index d98957b14ad1aca71870bcb8c4611edad64db1f3..51c36cc70257523a909e10cf94a2c9c6977208ec 100644 (file)
@@ -69,7 +69,6 @@ signals:
    /// Called on text changed
   virtual void onTextChanged(const QString&);
   void onValueChanged(const QString& theValue);
-  void onEditingFinished();
 
  protected:
    /// Removes extra trailing zero symbols
index a3f581d6b8fa4ad5c46e4be273f134051d81cdfe..81c53126dcc5ccfe35c5d631593755e12ce6497e 100755 (executable)
@@ -37,8 +37,6 @@
 #include <QDebug>
 #endif
 
-#define APPLY_BY_ENTER_OR_TAB
-
 ModuleBase_OperationFeature::ModuleBase_OperationFeature(const QString& theId, QObject* theParent)
 : ModuleBase_Operation(theId, theParent),
   myIsEditing(false)
@@ -269,11 +267,9 @@ bool ModuleBase_OperationFeature::commit()
     // changed.
     ModuleBase_IPropertyPanel* aPropertyPanel = propertyPanel();
     if (aPropertyPanel) {
-#ifdef APPLY_BY_ENTER_OR_TAB
       ModuleBase_ModelWidget* aWidget = aPropertyPanel->activeWidget();
       if (aWidget)
         aWidget->storeValueByApply();
-#endif
       aPropertyPanel->cleanContent();
     }
     SessionPtr aMgr = ModelAPI_Session::get();
index 2159c8125020b391e50d656c2d11de1e88ac4374..0486674270a027d0ea8134605c6d6faa86f885e1 100644 (file)
@@ -31,8 +31,6 @@
 #include <iostream>
 #endif
 
-#define APPLY_BY_ENTER_OR_TAB
-
 ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent,
                                                            const Config_WidgetAPI* theData,
                                                            const std::string& theParentId)
@@ -87,16 +85,10 @@ ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent,
   mySpinBox->setToolTip(aTTip);
 
   aControlLay->addRow(myLabel, mySpinBox);
-#ifdef APPLY_BY_ENTER_OR_TAB
   // Apply widget value change by enter/tab event.
-  //connect(mySpinBox, SIGNAL(editingFinished()), this, SIGNAL(valuesChanged()));
   connect(mySpinBox, SIGNAL(valueStored()), this, SIGNAL(valuesChanged()));
   connect(mySpinBox, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesModified()));
   connect(mySpinBox, SIGNAL(focusNextPrev()), this, SIGNAL(focusNextPrev()));
-
-#else
-  connect(mySpinBox, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesChanged()));
-#endif
 }
 
 ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue()
index b11bd67146184a661473321a58d4f8b0dabef582..3e040c4d39e6a7a32c9df3ab58c697c141cb3300 100644 (file)
@@ -214,8 +214,6 @@ void ExpressionEditor::paintEvent( QPaintEvent* theEvent )
 
 bool ExpressionEditor::focusNextPrevChild(bool theIsNext)
 {
-  if (myIsModified)
-    emit editingFinished();
   emit valueStored();
   emit focusNextPrev();
   return QPlainTextEdit::focusNextPrevChild(theIsNext);
@@ -250,7 +248,6 @@ ModuleBase_WidgetExprEditor::ModuleBase_WidgetExprEditor( QWidget* theParent,
   this->setLayout(aMainLay);
 
   connect(myEditor, SIGNAL(valueModified()), this, SIGNAL(valuesModified()));
-  //connect(myEditor, SIGNAL(editingFinished()), this, SLOT(onTextChanged()));
   connect(myEditor, SIGNAL(valueStored()), this, SLOT(onTextChanged()));
   connect(myEditor, SIGNAL(focusNextPrev()), this, SIGNAL(focusNextPrev()));
 
index 69f36b46c3da1061496b446ef8788ffee1b2d881..67d6453d64807eaf2d2cf00ce4eacc52b7dfb337 100644 (file)
@@ -64,7 +64,6 @@ class ExpressionEditor: public QPlainTextEdit
   void onTextChanged();
 
 signals:
-  void editingFinished();
   void valueModified();
   /// A signal that is emitted by the "Tab" key event. It is emitted before the key is processed.
   void valueStored();
index bb1d4a4d10c33ddd2a791029526af96e69a59ede..f9abf8af637a812c003f603084af816288a2e1a7 100644 (file)
@@ -34,8 +34,6 @@
 #include <iostream>
 #endif
 
-#define APPLY_BY_ENTER_OR_TAB
-
 ModuleBase_WidgetIntValue::ModuleBase_WidgetIntValue(QWidget* theParent,
                                                            const Config_WidgetAPI* theData,
                                                            const std::string& theParentId)
@@ -86,13 +84,10 @@ ModuleBase_WidgetIntValue::ModuleBase_WidgetIntValue(QWidget* theParent,
   mySpinBox->setToolTip(aTTip);
 
   aControlLay->addRow(myLabel, mySpinBox);
-#ifdef APPLY_BY_ENTER_OR_TAB
   // Apply widget value change by enter/tab event.
-  connect(mySpinBox, SIGNAL(editingFinished()), this, SIGNAL(valuesChanged()));
+  connect(mySpinBox, SIGNAL(valueStored()), this, SIGNAL(valuesChanged()));
   connect(mySpinBox, SIGNAL(valueChanged(int)), this, SIGNAL(valuesModified()));
-#else
-  connect(mySpinBox, SIGNAL(valueChanged(int)), this, SIGNAL(valuesChanged()));
-#endif
+  connect(mySpinBox, SIGNAL(focusNextPrev()), this, SIGNAL(focusNextPrev()));
 }
 
 ModuleBase_WidgetIntValue::~ModuleBase_WidgetIntValue()
index 8f62484fba31d5c2c42aa86374b92d26878c45e3..6cd4fb22afc36dcc77c01609c19e9113d99a2742 100644 (file)
@@ -51,8 +51,6 @@ const double MaxCoordinate = 1e12;
 
 static QStringList MyFeaturesForCoincedence;
 
-#define APPLY_BY_ENTER_OR_TAB
-
 PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent, 
                                              ModuleBase_IWorkshop* theWorkshop,
                                              const Config_WidgetAPI* theData,
@@ -88,16 +86,10 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent,
     myXSpin->setToolTip(tr("X"));
     aGroupLay->addWidget(myXSpin, 0, 1);
 
-#ifdef APPLY_BY_ENTER_OR_TAB
     // Apply widget value change by enter/tab event.
-    //connect(myXSpin, SIGNAL(editingFinished()), this, SLOT(onValuesChanged()));
-    //connect(myXSpin, SIGNAL(focusNextPrev()), this, SLOT(onValuesChanged()));
     connect(myXSpin, SIGNAL(valueStored()), this, SLOT(onValuesChanged()));
     connect(myXSpin, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesModified()));
     connect(myXSpin, SIGNAL(focusNextPrev()), this, SIGNAL(focusNextPrev()));
-#else
-    connect(myXSpin, SIGNAL(valueChanged(const QString&)), this, SLOT(onValuesChanged()));
-#endif
   }
   {
     QLabel* aLabel = new QLabel(myGroupBox);
@@ -110,15 +102,10 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent,
     myYSpin->setToolTip(tr("Y"));
     aGroupLay->addWidget(myYSpin, 1, 1);
 
-#ifdef APPLY_BY_ENTER_OR_TAB
     // Apply widget value change by enter/tab event.
-    //connect(myYSpin, SIGNAL(editingFinished()), this, SLOT(onValuesChanged()));
     connect(myYSpin, SIGNAL(valueStored()), this, SLOT(onValuesChanged()));
     connect(myYSpin, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesModified()));
     connect(myYSpin, SIGNAL(focusNextPrev()), this, SIGNAL(focusNextPrev()));
-#else
-    connect(myYSpin, SIGNAL(valueChanged(const QString&)), this, SLOT(onValuesChanged()));
-#endif
   }
   QVBoxLayout* aLayout = new QVBoxLayout(this);
   ModuleBase_Tools::zeroMargins(aLayout);
index d2f1a08aaef00d9598a035cdfed552b6f627159a..ef7bf36c0d2430458290408ec283738b2f1f4ba3 100644 (file)
@@ -22,8 +22,6 @@
 
 #include <QMouseEvent>
 
-#define APPLY_BY_ENTER_OR_TAB
-
 PartSet_WidgetPoint2dDistance::PartSet_WidgetPoint2dDistance(QWidget* theParent,
                                                              ModuleBase_IWorkshop* theWorkshop,
                                                              const Config_WidgetAPI* theData,
@@ -31,18 +29,6 @@ PartSet_WidgetPoint2dDistance::PartSet_WidgetPoint2dDistance(QWidget* theParent,
  : ModuleBase_WidgetDoubleValue(theParent, theData, theParentId), myWorkshop(theWorkshop)
 {
   myFirstPntName = theData->getProperty("first_point");
-
-  // Reconnect to local slot
-#ifdef APPLY_BY_ENTER_OR_TAB
-  // Apply widget value change by enter/tab event.
-  //disconnect(mySpinBox, SIGNAL(editingFinished()), this, SIGNAL(valuesChanged()));
-  disconnect(mySpinBox, SIGNAL(valueStored()), this, SIGNAL(valuesChanged()));
-  connect(mySpinBox, SIGNAL(editingFinished()), this, SLOT(onValuesChanged()));
-  connect(mySpinBox, SIGNAL(valueChanged(double)), this, SIGNAL(valuesModified()));
-#else
-  disconnect(mySpinBox, SIGNAL(valueChanged(double)), this, SIGNAL(valuesChanged()));
-  connect(mySpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValuesChanged()));
-#endif
 }
 
 PartSet_WidgetPoint2dDistance::~PartSet_WidgetPoint2dDistance()
@@ -132,11 +118,6 @@ void PartSet_WidgetPoint2dDistance::onMouseMove(ModuleBase_IViewWindow* theWnd,
   setValueState(ModifiedInViewer);
 }
 
-void PartSet_WidgetPoint2dDistance::onValuesChanged()
-{
-  emit valuesChanged();
-}
-
 bool PartSet_WidgetPoint2dDistance::processEnter()
 {
   bool isModified = mySpinBox->isModified();
index 47256180451265fc62da45790fe9551a464bc025..7b350d33edd8623e5e9a265bb1c89fe4d5c1010e 100644 (file)
@@ -87,10 +87,6 @@ protected:
   virtual double computeValue(const std::shared_ptr<GeomAPI_Pnt2d>& theFirstPnt,
                               const std::shared_ptr<GeomAPI_Pnt2d>& theCurrentPnt);
 
-private slots:
-  /// Process values changed event
-  void onValuesChanged();
-
 protected:
   /// A reference to workshop
   ModuleBase_IWorkshop* myWorkshop;