]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
0020864: EDF 1409 SMESH: Suppression of algorithms causes Salome to crash
authorvsr <vsr@opencascade.com>
Thu, 13 May 2010 11:45:29 +0000 (11:45 +0000)
committervsr <vsr@opencascade.com>
Thu, 13 May 2010 11:45:29 +0000 (11:45 +0000)
src/Qtx/QtxTreeView.cxx
src/Qtx/QtxTreeView.h

index ef551abc427917db6a2c74653f53f06a11776aa1..d86270d85482f2ea6767119933ef340c9893265c 100644 (file)
@@ -319,6 +319,22 @@ void QtxTreeView::selectionChanged( const QItemSelection& selected,
   emit( selectionChanged() );
 }
 
+/*!
+  \brief Called when rows are about to be removed.
+  \param parent model index
+  \param start first row to remove
+  \param end last row to remove
+*/
+void QtxTreeView::rowsAboutToBeRemoved( const QModelIndex& parent, int start, int end )
+{
+  QModelIndex curIndex = currentIndex();
+  while ( curIndex.isValid() && curIndex.parent() != parent )
+    curIndex = curIndex.parent();
+  if ( curIndex.isValid() && curIndex.row() >= start && curIndex.row() <= end )
+    setCurrentIndex( QModelIndex() );
+  QTreeView::rowsAboutToBeRemoved( parent, start, end );
+}
+
 /*!
   \brief Expand/collapse the specified item (recursively).
   \param index model index
index af16b8284bf50df31c801e30b99083089f54a00b..d63c9bdadc4c2a78367ec6366d25daf55096c6d8 100644 (file)
@@ -57,6 +57,7 @@ public:
 
 protected slots:
   void     onHeaderClicked( int );
+  void     rowsAboutToBeRemoved( const QModelIndex&, int, int );
   void     selectionChanged( const QItemSelection&, const QItemSelection& );
   void     onAppropriate( Qt::Orientation, int, int );