Salome HOME
Bug #157: "Tab" button doesn't switch active spinboxes in Modification mode.
authormzn <mzn@opencascade.com>
Fri, 13 Dec 2013 13:01:14 +0000 (13:01 +0000)
committermzn <mzn@opencascade.com>
Fri, 13 Dec 2013 13:01:14 +0000 (13:01 +0000)
src/HYDROCurveCreator/CurveCreator_TableView.cxx
src/HYDROCurveCreator/CurveCreator_TableView.h
src/HYDROCurveCreator/CurveCreator_Widget.cxx

index b0c4d527f87186dd5aee432a3011ae31536ffa66..56d3a507e9f7cbcf01a4a80ad54bf042068aebbc 100644 (file)
@@ -112,42 +112,51 @@ void CurveCreator_TableView::setCurve( CurveCreator_ICurve* theCurve )
   myCurve = theCurve;
 }
 
-void CurveCreator_TableView::addLocalPointToTable(
-                     const CurveCreator_ICurve::SectionToPoint& theSToPoint )
+void CurveCreator_TableView::setLocalPointsToTable(
+  const CurveCreator_ICurve::SectionToPointList& thePoints )
 {
-  int aRowId = rowCount();
-  int anISection = theSToPoint.first;
-  int anIPoint = theSToPoint.second;
-  bool isFoundPoint = false;
-  for ( int i = 0; i < aRowId && !isFoundPoint; i++ )
-    isFoundPoint = getSectionId( i ) == anISection && 
-                   getPointId( i ) == anIPoint;
-  if ( isFoundPoint )
-    return;
-
-  setRowCount( aRowId+1 );
-
-  QTableWidgetItem* anItem;
-  anItem = new QTableWidgetItem( myCurve->getSectionName( anISection ).c_str() );
-  anItem->setFlags( anItem->flags() & ~Qt::ItemIsEnabled );
-  anItem->setData( Qt::UserRole, anISection );
-  setItem( aRowId, 0, anItem );
-
-  anItem = new QTableWidgetItem( QString::number( anIPoint + 1 ) );
-  anItem->setFlags( anItem->flags() & ~Qt::ItemIsEnabled );
-  anItem->setData( Qt::UserRole, anIPoint );
-  setItem( aRowId, 1, anItem );
-
-  gp_Pnt aPoint;
-  CurveCreator_UtilsICurve::getPoint( myCurve, anISection, anIPoint, aPoint );
-
-  anItem = new QTableWidgetItem( QString::number( aPoint.X(), 'f', 2 ) );
-  anItem->setData( Qt::UserRole, aPoint.X() );
-  setItem( aRowId, 2, anItem );
-
-  anItem = new QTableWidgetItem( QString::number( aPoint.Y(), 'f', 2 ) );
-  anItem->setData( Qt::UserRole, aPoint.Y() );
-  setItem( aRowId, 3, anItem );
+  setRowCount( thePoints.size() );
+
+  int aRowId = 0;
+  CurveCreator_ICurve::SectionToPointList::const_iterator anIt = thePoints.begin(),
+                                                          aLast = thePoints.end();
+  for ( ; anIt != aLast; anIt++ ) {
+    CurveCreator_ICurve::SectionToPoint aSPoint = *anIt;
+    int anISection = aSPoint.first;
+    int anIPoint = aSPoint.second;
+
+    QTableWidgetItem* anItem;
+    anItem = new QTableWidgetItem( myCurve->getSectionName( anISection ).c_str() );
+    anItem->setFlags( anItem->flags() & ~Qt::ItemIsEnabled );
+    anItem->setData( Qt::UserRole, anISection );
+    setItem( aRowId, 0, anItem );
+
+    anItem = new QTableWidgetItem( QString::number( anIPoint + 1 ) );
+    anItem->setFlags( anItem->flags() & ~Qt::ItemIsEnabled );
+    anItem->setData( Qt::UserRole, anIPoint );
+    setItem( aRowId, 1, anItem );
+
+    gp_Pnt aPoint;
+    CurveCreator_UtilsICurve::getPoint( myCurve, anISection, anIPoint, aPoint );
+
+    anItem = item( aRowId, 2 );
+    if ( !anItem ) {
+      anItem = new QTableWidgetItem();
+      setItem( aRowId, 2, anItem );
+    }
+    anItem->setData( Qt::UserRole, aPoint.X() );
+    anItem->setData( Qt::DisplayRole, QString::number( aPoint.X(), 'f', 2 ) );
+
+    anItem = item( aRowId, 3 );
+    if ( !anItem ) {
+      anItem = new QTableWidgetItem();
+      setItem( aRowId, 3, anItem );
+    }
+    anItem->setData( Qt::UserRole, aPoint.Y() );
+    anItem->setData( Qt::DisplayRole, QString::number( aPoint.Y(), 'f', 2 ) );
+
+    aRowId++;
+  }
 }
 
 int CurveCreator_TableView::getSectionId( const int theRowId ) const
index bb8f73240fa1c2baf49768d7474fd7c5c31279ca..4cf381ba7d1baf683ff4a81184a2e05347afda94 100644 (file)
@@ -47,7 +47,7 @@ public:
 
   void setCurve( CurveCreator_ICurve* theCurve );
 
-  void addLocalPointToTable( const CurveCreator_ICurve::SectionToPoint& thePoint );
+  void setLocalPointsToTable( const CurveCreator_ICurve::SectionToPointList& thePoints );
 
   /**
    * Returns a section index from the table
index 5fdb921d28de21b5c9065dfc83344833641964c2..72d7ffa7e52de76a9e9dc41dd18f229f2dfb66df 100644 (file)
@@ -1307,11 +1307,8 @@ void CurveCreator_Widget::updateLocalPointView()
 
   if ( !isRowLimit ) {
     bool isBlocked = myLocalPointView->blockSignals(true);
-    myLocalPointView->setRowCount( 0 );
-    CurveCreator_ICurve::SectionToPointList::const_iterator anIt = myLocalPoints.begin(),
-                                                            aLast = myLocalPoints.end();
-    for ( ; anIt != aLast; anIt++ )
-      myLocalPointView->addLocalPointToTable( *anIt );
+
+    myLocalPointView->setLocalPointsToTable( myLocalPoints );
 
     myLocalPointView->blockSignals( isBlocked );
   }