From 81c34e7c0817dbbb846cbc3725f2ae8526cf383c Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 13 May 2010 11:45:29 +0000 Subject: [PATCH] 0020864: EDF 1409 SMESH: Suppression of algorithms causes Salome to crash --- src/Qtx/QtxTreeView.cxx | 16 ++++++++++++++++ src/Qtx/QtxTreeView.h | 1 + 2 files changed, 17 insertions(+) diff --git a/src/Qtx/QtxTreeView.cxx b/src/Qtx/QtxTreeView.cxx index ef551abc4..d86270d85 100644 --- a/src/Qtx/QtxTreeView.cxx +++ b/src/Qtx/QtxTreeView.cxx @@ -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 diff --git a/src/Qtx/QtxTreeView.h b/src/Qtx/QtxTreeView.h index af16b8284..d63c9bdad 100644 --- a/src/Qtx/QtxTreeView.h +++ b/src/Qtx/QtxTreeView.h @@ -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 ); -- 2.39.2