From d348497e9ff7822c853c2f12ae042d1979285888 Mon Sep 17 00:00:00 2001 From: mzn Date: Wed, 2 Jul 2008 13:49:36 +0000 Subject: [PATCH] Fix for bug IPAL19982 (Qt4 porting: Double-click on red link (reference object) doesn't select the original). --- src/SalomeApp/SalomeApp_Application.cxx | 51 +++++++++---------------- src/SalomeApp/SalomeApp_Application.h | 4 +- 2 files changed, 20 insertions(+), 35 deletions(-) diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index c085ab018..02b419ac2 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #include @@ -46,6 +47,7 @@ #include #include #include +#include #include #include @@ -752,8 +754,7 @@ QWidget* SalomeApp_Application::createWindow( const int flag ) // temporary commented //ob->setUpdater( new SalomeApp_Updater() ); - // temporary commented - //connect( ob->listView(), SIGNAL( doubleClicked( QListViewItem* ) ), this, SLOT( onDblClick( QListViewItem* ) ) );*/ + connect( ob, SIGNAL( doubleClicked( SUIT_DataObject* ) ), this, SLOT( onDblClick( SUIT_DataObject* ) ) ); bool autoSize = resMgr->booleanValue( "ObjectBrowser", "auto_size", false ); bool autoSizeFirst = resMgr->booleanValue( "ObjectBrowser", "auto_size_first", true ); @@ -1168,47 +1169,31 @@ void SalomeApp_Application::onRegDisplay() } /*!find original object by double click on item */ -void SalomeApp_Application::onDblClick( QListViewItem* it ) +void SalomeApp_Application::onDblClick( SUIT_DataObject* theObj ) { - // temporary commented - /*OB_ListItem* item = dynamic_cast( it ); + SalomeApp_DataObject* obj = dynamic_cast( theObj ); SalomeApp_Study* study = dynamic_cast( activeStudy() ); - if( study && item ) + if( study && obj ) { - SalomeApp_DataObject* obj = dynamic_cast( item->dataObject() ); - if( !obj ) - return; - QString entry = obj->entry(); - _PTR(SObject) sobj = study->studyDS()->FindObjectID( entry.latin1() ), ref; + _PTR(SObject) sobj = study->studyDS()->FindObjectID( entry.toStdString() ), ref; if( sobj && sobj->ReferencedObject( ref ) ) { entry = ref->GetID().c_str(); - QListViewItemIterator anIt( item->listView() ); - for( ; anIt.current(); anIt++ ) - { - OB_ListItem* item = dynamic_cast( anIt.current() ); - if( !item ) - continue; - - SalomeApp_DataObject* original = dynamic_cast( item->dataObject() ); - if( original->entry()!=entry ) - continue; - - OB_Browser* br = objectBrowser(); - br->setSelected( original ); - SUIT_DataObject* p = original->parent(); - while( p ) - { - br->setOpen( p ); - p = p->parent(); - } - break; - } + + SUIT_DataOwnerPtrList aList; + aList.append( new LightApp_DataOwner( entry ) ); + selectionMgr()->setSelected( aList, false ); + + SUIT_DataBrowser* ob = objectBrowser(); + + QModelIndexList aSelectedIndexes = ob->selectedIndexes(); + if ( !aSelectedIndexes.isEmpty() ) + ob->treeView()->scrollTo( aSelectedIndexes.first() ); } - }*/ + } } /*! diff --git a/src/SalomeApp/SalomeApp_Application.h b/src/SalomeApp/SalomeApp_Application.h index 72954e919..c7c01846e 100644 --- a/src/SalomeApp/SalomeApp_Application.h +++ b/src/SalomeApp/SalomeApp_Application.h @@ -41,10 +41,10 @@ class LightApp_Preferences; class SalomeApp_Study; +class SUIT_DataObject; class SALOME_LifeCycleCORBA; -class QListViewItem;//? waiting for object browser porting #ifdef WIN32 #pragma warning( disable:4251 ) @@ -136,7 +136,7 @@ protected: private slots: void onDeleteInvalidReferences(); - void onDblClick( QListViewItem* ); + void onDblClick( SUIT_DataObject* ); void onProperties(); void onDumpStudy(); void onLoadScript(); -- 2.39.2