]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix for bug IPAL19982 (Qt4 porting: Double-click on red link (reference object) doesn...
authormzn <mzn@opencascade.com>
Wed, 2 Jul 2008 13:49:36 +0000 (13:49 +0000)
committermzn <mzn@opencascade.com>
Wed, 2 Jul 2008 13:49:36 +0000 (13:49 +0000)
src/SalomeApp/SalomeApp_Application.cxx
src/SalomeApp/SalomeApp_Application.h

index c085ab018a7c19cd18ad065d59e594303f2b316b..02b419ac2c4fd5c3fd25a015fb2c3c7e70134ed9 100644 (file)
@@ -36,6 +36,7 @@
 #include <LightApp_Preferences.h>
 #include <LightApp_SelectionMgr.h>
 #include <LightApp_NameDlg.h>
+#include <LightApp_DataOwner.h>
 
 #include <CAM_Module.h>
 
@@ -46,6 +47,7 @@
 #include <SUIT_FileDlg.h>
 #include <SUIT_MessageBox.h>
 #include <SUIT_ResourceMgr.h>
+#include <SUIT_TreeModel.h>
 
 #include <QtxMRUAction.h>
 #include <QtxTreeView.h>
@@ -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<OB_ListItem*>( it );
+  SalomeApp_DataObject* obj = dynamic_cast<SalomeApp_DataObject*>( theObj );
   SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( activeStudy() );
 
-  if( study && item )
+  if( study && obj )
   {
-    SalomeApp_DataObject* obj = dynamic_cast<SalomeApp_DataObject*>( 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<OB_ListItem*>( anIt.current() );
-       if( !item )
-         continue;
-
-       SalomeApp_DataObject* original = dynamic_cast<SalomeApp_DataObject*>( 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() );
     }
-  }*/
+  }
 }
 
 /*!
index 72954e9197a8d80ba0bdf9e382969b5207f0b96e..c7c01846ebe38ba9c6aea58743d1e9b87da96fcf 100644 (file)
 
 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();