From 406340d2f03f397184dba941e97c2518c0bd79ff Mon Sep 17 00:00:00 2001 From: rnv Date: Fri, 12 Dec 2008 13:31:36 +0000 Subject: [PATCH] IPAL20771 & IPAL20756 --- src/SalomeApp/SalomeApp_NoteBookDlg.cxx | 30 +++++++++++++++++++++++-- src/SalomeApp/SalomeApp_NoteBookDlg.h | 2 ++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/SalomeApp/SalomeApp_NoteBookDlg.cxx b/src/SalomeApp/SalomeApp_NoteBookDlg.cxx index dc9ce5587..a5c148be8 100644 --- a/src/SalomeApp/SalomeApp_NoteBookDlg.cxx +++ b/src/SalomeApp/SalomeApp_NoteBookDlg.cxx @@ -200,6 +200,16 @@ QTableWidgetItem* NoteBook_TableRow::GetNameItem() return myVariableName; } +//============================================================================ +/*! Function : GetHeaderItem + * Purpose : + */ +//============================================================================ +QTableWidgetItem* NoteBook_TableRow::GetHeaderItem() +{ + return myRowHeader; +} + //============================================================================ /*! Function : IsRealValue * Purpose : Return true if theValue string is real value, otherwise return @@ -412,6 +422,17 @@ bool NoteBook_Table::IsValid() const return true; } +//============================================================================ +/*! Function : RenamberRowItems + * Purpose : renumber row items + */ +//============================================================================ +void NoteBook_Table::RenamberRowItems(){ + for(int i=0; iGetHeaderItem()->setText(QString::number(i+1)); + } +} + //============================================================================ /*! Function : AddRow * Purpose : Add a row into the table @@ -584,7 +605,7 @@ void NoteBook_Table::RemoveSelected() isProcessItemChangedSignal = true; return; } - + bool removedFromStudy = false; for(int i=0; i < aSelectedItems.size(); i++ ) { NoteBook_TableRow* aRow = GetRowByItem(aSelectedItems[i]); if(aRow) { @@ -607,15 +628,20 @@ void NoteBook_Table::RemoveSelected() } int index = aRow->GetIndex(); + QString aVarName = aRow->GetName(); myRemovedRows.append( index ); if( myVariableMap.contains( index ) ) myVariableMap.remove( index ); - removeRow(nRow); myRows.removeAt(nRow); + if(myStudy->IsVariable(aVarName.toLatin1().constData())) + removedFromStudy = true; } } } + if(removedFromStudy) + myIsModified = true; + RenamberRowItems(); isProcessItemChangedSignal = true; } diff --git a/src/SalomeApp/SalomeApp_NoteBookDlg.h b/src/SalomeApp/SalomeApp_NoteBookDlg.h index c4a7994af..431b50ced 100644 --- a/src/SalomeApp/SalomeApp_NoteBookDlg.h +++ b/src/SalomeApp/SalomeApp_NoteBookDlg.h @@ -71,6 +71,7 @@ class SALOMEAPP_EXPORT NoteBook_TableRow : public QWidget QTableWidgetItem* GetVariableItem(); QTableWidgetItem* GetNameItem(); + QTableWidgetItem* GetHeaderItem(); static bool IsRealValue(const QString theValue, double* theResult = 0); static bool IsIntegerValue(const QString theValue, int* theResult = 0); @@ -113,6 +114,7 @@ class SALOMEAPP_EXPORT NoteBook_Table : public QTableWidget const QList& GetRemovedRows() const { return myRemovedRows; } const VariableMap& GetVariableMap() const { return myVariableMap; } const VariableMap& GetVariableMapRef() const { return myVariableMapRef; } + void RenamberRowItems(); void ResetMaps(); -- 2.39.2