Get back the removed update for the view if number of points is changed.
return aSect;
}
+void CurveCreator_TreeView::pointsAdded( int theSection, int thePoint, int thePointsCnt )
+{
+ CurveCreator_TreeViewModel* aModel = dynamic_cast<CurveCreator_TreeViewModel*>(model());
+ if( aModel ){
+ QModelIndex aSectIndx = aModel->sectionIndex( theSection );
+ rowsInserted(aSectIndx, thePoint, thePoint + thePointsCnt - 1 );
+// expand( aSectIndx );
+ update( aModel->nbPointsIndex( theSection ) );
+ }
+}
+
+void CurveCreator_TreeView::pointDataChanged( int theSection, int thePoint )
+{
+ CurveCreator_TreeViewModel* aModel = dynamic_cast<CurveCreator_TreeViewModel*>(model());
+ if( aModel ){
+ QModelIndex aPointIndx = aModel->pointIndex( theSection, thePoint );
+ dataChanged( aPointIndx, aPointIndx );
+ }
+}
+
+void CurveCreator_TreeView::pointsRemoved( int theSection, int thePoint, int thePointsCnt )
+{
+ CurveCreator_TreeViewModel* aModel = dynamic_cast<CurveCreator_TreeViewModel*>(model());
+ if( aModel ){
+ for( int i = 0 ; i < thePointsCnt ; i++ ){
+ QModelIndex aSectIndx = aModel->pointIndex(theSection, thePoint + i);
+ selectionModel()->select(aSectIndx,QItemSelectionModel::Deselect);
+ }
+ QModelIndex aSectIndx = aModel->sectionIndex( theSection );
+ rowsRemoved(aSectIndx, thePoint, thePoint + thePointsCnt - 1 );
+ }
+}
+
void CurveCreator_TreeView::sectionAdded( int theSection )
{
CurveCreator_TreeViewModel* aModel = dynamic_cast<CurveCreator_TreeViewModel*>(model());
SelectionType getSelectionType() const;
QList<int> getSelectedSections() const;
+ void pointsAdded( int theSection, int thePoint, int thePointsCnt=1 );
+ void pointDataChanged( int theSection, int thePoint );
+ void pointsRemoved(int theSection, int thePoint, int thePointsCnt=1 );
+
void sectionAdded( int theSection );
void sectionChanged(int theSection , int aSectCnt = 1);
void sectionsRemoved( int theSection, int theSectionCnt=1 );
for( int i = 0; i < aSections.size() ; i++ ){
aSectionsToJoin.push_back( aSections[i] );
}
-
+ //int aMainSect = aSectionsToJoin.front();
+ //int aMainSectSize = myCurve->getNbPoints(aMainSect);
if ( myCurve->join( aSectionsToJoin ) )
{
- for( int i = 0, aSectionsSize = aSectionsToJoin.size(); i < aSectionsSize; i++ )
- mySectionView->sectionsRemoved( i );
+ std::list<int>::const_iterator anIt = aSectionsToJoin.begin(),
+ aLast = aSectionsToJoin.end();
+ // the first section should be skipped. It is not removed, but is modified
+ anIt++;
+ for ( ; anIt != aLast; anIt++ )
+ mySectionView->sectionsRemoved( *anIt );
}
+ /* The update for the points of the main section
+ int aNewSectSize = myCurve->getNbPoints(aMainSect);
+ if( aNewSectSize != aMainSectSize )
+ mySectionView->pointsAdded( aMainSect, aMainSectSize, aNewSectSize-aMainSectSize );*/
updateUndoRedo();
}
}
int aSection = aSections[0];
myCurve->addPoints(theCoords, aSection); // add to the end of section
+ mySectionView->pointsAdded( aSection, myCurve->getNbPoints( aSection ) );
updateActionsStates();
updateUndoRedo();
}
anInsertPos = aPoint1Id < aPoint2Id ? aPoint1Id + 1 : aPoint2Id + 1;
myCurve->addPoints( aCoords, aSectionId, anInsertPos );
+ mySectionView->pointsAdded( aSectionId, myCurve->getNbPoints( aSectionId ) );
finishCurveModification( aSelPoints );