#include <SUIT_DataObject.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_SelectionMgr.h>
+#include <SUIT_DataObjectIterator.h>
#define VISIBILITY_COLUMN_WIDTH 25
{
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" ) );
setWindowTitle( tr( "OBJECT_BROWSER" ) );
connect( this, SIGNAL( requestUpdate() ), theModule->getApp(), SLOT( onRefresh() ) );
+ 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<SUIT_AbstractModel*>( model() );
- treeModel->setSearcher( theModule->getApp() );
+ //RKV: treeModel->setSearcher( theModule->getApp() );
+ treeModel->setSearcher( this ); //RKV
+ treeModel->registerColumn( 0, EntryCol, LightApp_DataObject::EntryId );
+ 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
- //RKV: TODO: Uncomment for drag and drop
- //RKV: SUIT_ProxyModel* proxyModel = dynamic_cast<SUIT_ProxyModel*>(treeModel);
- //RKV: if ( proxyModel ) {
- //RKV: connect( proxyModel, SIGNAL( dropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction ) ),
- //RKV: theModule->getApp(), SLOT( onDropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction ) ) );
- //RKV: }
+ SUIT_ProxyModel* proxyModel = dynamic_cast<SUIT_ProxyModel*>(treeModel);
+ if ( proxyModel ) {
+ connect( proxyModel,
+ SIGNAL( dropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction ) ),
+ SIGNAL( dropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction ) ) );
+
+ //// Connect signal emitted after editing for updating after objects renaming
+ SUIT_TreeModel* aMiniModel = dynamic_cast<SUIT_TreeModel*>( 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<SUIT_ProxyModel*>(aModulBrowser->model());
+ if ( aPModel )
+ {
+ SUIT_TreeModel* aModel = dynamic_cast<SUIT_TreeModel*>(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
/*
treeView()->header()->setResizeMode(SUIT_DataObject::VisibilityId, QHeaderView::Fixed);
treeView()->header()->moveSection(SUIT_DataObject::NameId,SUIT_DataObject::VisibilityId);
treeView()->setColumnWidth(SUIT_DataObject::VisibilityId, VISIBILITY_COLUMN_WIDTH);
+ treeView()->hideColumn( SUIT_DataObject::VisibilityId );
+ treeView()->hideColumn( LightApp_DataObject::EntryId );
//RKV: connectPopupRequest( theModule->getApp(), SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
}
HYDROGUI_DataBrowser::~HYDROGUI_DataBrowser()
{
}
+
+SUIT_DataObject* HYDROGUI_DataBrowser::findObject( const QString& theEntry ) const
+{
+ LightApp_DataObject* aCurObj;
+ for ( SUIT_DataObjectIterator it( root(), SUIT_DataObjectIterator::DepthLeft ); it.current(); ++it ) {
+ aCurObj = dynamic_cast<LightApp_DataObject*>( it.current() );
+ if ( aCurObj && aCurObj->entry() == theEntry )
+ return aCurObj;
+ }
+ return NULL;
+}