X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_DataBrowser.cxx;h=2c16b0c6383c3efdc03373dc493ce0ad033d9aab;hb=f34b90e9e4e02ba65419134d5d37a2e42aecfabf;hp=f4cc73c2b0ad64f157d411c65e972e741280dd89;hpb=bfe9d3ccf8d5347b917d4c9e5e89413cebe51cc6;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_DataBrowser.cxx b/src/HYDROGUI/HYDROGUI_DataBrowser.cxx index f4cc73c2..2c16b0c6 100644 --- a/src/HYDROGUI/HYDROGUI_DataBrowser.cxx +++ b/src/HYDROGUI/HYDROGUI_DataBrowser.cxx @@ -42,8 +42,15 @@ HYDROGUI_DataBrowser::HYDROGUI_DataBrowser( HYDROGUI_Module* theModule, SUIT_Dat { SUIT_ResourceMgr* resMgr = theModule->getApp()->resourceMgr(); + if ( ( !theRoot ) && theModule ) + { + // Initialize the root with the module data model + setRoot( new CAM_ModuleObject( theModule->dataModel(), NULL ) ); + } + setSortMenuEnabled( true ); setAutoUpdate( true ); + setUpdateModified( true ); if ( resMgr->hasValue( "ObjectBrowser", "auto_hide_search_tool" ) ) searchTool()->enableAutoHide( resMgr->booleanValue( "ObjectBrowser", "auto_hide_search_tool" ) ); @@ -53,7 +60,8 @@ HYDROGUI_DataBrowser::HYDROGUI_DataBrowser( HYDROGUI_Module* theModule, SUIT_Dat QString EntryCol = QObject::tr( "ENTRY_COLUMN" ); QString RefObjCol = tr( "REF_OBJECT_COLUMN" ); - QString BathymetryCol = tr( "BATHYMETRY_COLUMN" ); + QString AltitudeCol = tr( "ALTITUDE_COLUMN" ); + SUIT_AbstractModel* treeModel = dynamic_cast( model() ); //RKV: treeModel->setSearcher( theModule->getApp() ); treeModel->setSearcher( this ); //RKV @@ -61,8 +69,8 @@ HYDROGUI_DataBrowser::HYDROGUI_DataBrowser( HYDROGUI_Module* theModule, SUIT_Dat treeModel->setAppropriate( EntryCol, Qtx::Toggled ); treeModel->registerColumn( 0, RefObjCol, HYDROGUI_DataObject::RefObjectId ); treeModel->setAppropriate( RefObjCol, Qtx::Toggled ); - treeModel->registerColumn( 0, BathymetryCol, HYDROGUI_DataObject::BathymetryId ); - treeModel->setAppropriate( BathymetryCol, Qtx::Toggled ); + treeModel->registerColumn( 0, AltitudeCol, HYDROGUI_DataObject::AltitudeObjId ); + treeModel->setAppropriate( AltitudeCol, Qtx::Toggled ); // Mantis issue 0020136: Drag&Drop in OB SUIT_ProxyModel* proxyModel = dynamic_cast(treeModel); @@ -70,6 +78,33 @@ HYDROGUI_DataBrowser::HYDROGUI_DataBrowser( HYDROGUI_Module* theModule, SUIT_Dat connect( proxyModel, SIGNAL( dropped( const QList&, SUIT_DataObject*, int, Qt::DropAction ) ), SIGNAL( dropped( const QList&, SUIT_DataObject*, int, Qt::DropAction ) ) ); + + //// Connect signal emitted after editing for updating after objects renaming + SUIT_TreeModel* aMiniModel = dynamic_cast( proxyModel->sourceModel() ); + if ( aMiniModel ) + { + connect( aMiniModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ), + SIGNAL( dataChanged() ) ); + } + + // Do updating also in the module's main object browser. + if ( theModule ) + { + SUIT_DataBrowser* aModulBrowser = theModule->getApp()->objectBrowser(); + if ( aModulBrowser ) + { + SUIT_ProxyModel* aPModel = dynamic_cast(aModulBrowser->model()); + if ( aPModel ) + { + SUIT_TreeModel* aModel = dynamic_cast(aPModel->sourceModel()); + //connect( proxyModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ), + // aPModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ) ); + //connect( proxyModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ), + // aModel, SIGNAL( dataChanged( const QModelIndex &, const QModelIndex & ) ) ); + connect( proxyModel, SIGNAL( modelUpdated() ), aModel, SIGNAL( modelUpdated() ) ); + } + } + } } // temporary commented