From a950a8e1fde8203e9d1a6cd00fb811238dea4245 Mon Sep 17 00:00:00 2001 From: imn Date: Mon, 7 Dec 2015 16:30:32 +0300 Subject: [PATCH] Fix pb. with Object Browser --- src/SUIT/SUIT_TreeModel.cxx | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/SUIT/SUIT_TreeModel.cxx b/src/SUIT/SUIT_TreeModel.cxx index e6cd32fdb..2753ac368 100755 --- a/src/SUIT/SUIT_TreeModel.cxx +++ b/src/SUIT/SUIT_TreeModel.cxx @@ -500,6 +500,9 @@ SUIT_TreeModel::~SUIT_TreeModel() void SUIT_TreeModel::registerColumn( const int group_id, const QString& name, const int custom_id ) { bool found = false; +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + beginResetModel(); +#endif for ( int i=0, n=myColumns.size(); i= QT_VERSION_CHECK(4, 6, 0) + endResetModel(); +#else reset(); #endif } @@ -535,12 +540,17 @@ void SUIT_TreeModel::registerColumn( const int group_id, const QString& name, co void SUIT_TreeModel::unregisterColumn( const int group_id, const QString& name ) { for ( int i = 0, n = myColumns.size(); i < n; i++ ) { +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + beginResetModel(); +#endif if ( myColumns[i].myName == name ) { myColumns[i].myIds.remove( group_id ); if ( myColumns[i].myIds.isEmpty() ) { - myColumns.remove( i ); -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - reset(); + myColumns.remove( i ); +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + endResetModel(); +#else + reset(); #endif } break; @@ -751,6 +761,10 @@ void SUIT_TreeModel::setRoot( SUIT_DataObject* r ) if ( root() == r ) return; +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + beginResetModel(); +#endif + if ( autoDeleteTree() ) { SUIT_DataObject::disconnect( SIGNAL( inserted( SUIT_DataObject*, SUIT_DataObject* ) ), this, SLOT( onInserted( SUIT_DataObject*, SUIT_DataObject* ) ) ); @@ -770,7 +784,9 @@ void SUIT_TreeModel::setRoot( SUIT_DataObject* r ) myRoot = r; //initialize(); -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) + endResetModel(); +#else reset(); #endif emit modelUpdated(); -- 2.39.2