From cca73342d4340060a76d3e0aadda5163300027a0 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 11 Nov 2011 07:51:03 +0000 Subject: [PATCH] Merge debug for TRIPOLI (V6_1_BR, 11/11/11) --- src/OCCViewer/OCCViewer_ViewModel.h | 10 ++++----- src/SUIT/SUIT_DataBrowser.cxx | 33 +++++++++++++++++++++++++++++ src/SUIT/SUIT_DataBrowser.h | 3 +++ 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/OCCViewer/OCCViewer_ViewModel.h b/src/OCCViewer/OCCViewer_ViewModel.h index 8f08f28c6..5c5c7bfe2 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.h +++ b/src/OCCViewer/OCCViewer_ViewModel.h @@ -144,10 +144,10 @@ signals: protected: protected slots: - void onMousePress(SUIT_ViewWindow*, QMouseEvent*); - void onMouseMove(SUIT_ViewWindow*, QMouseEvent*); - void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*); - void onKeyPress(SUIT_ViewWindow*, QKeyEvent*); + virtual void onMousePress(SUIT_ViewWindow*, QMouseEvent*); + virtual void onMouseMove(SUIT_ViewWindow*, QMouseEvent*); + virtual void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*); + virtual void onKeyPress(SUIT_ViewWindow*, QKeyEvent*); void onDumpView(); void onChangeBgColor(); @@ -155,7 +155,7 @@ protected slots: void onChangeBgImageTiled(); void onChangeBgImageStretched(); -private: +protected: Handle(V3d_Viewer) myV3dViewer; Handle(V3d_Viewer) myV3dCollector; diff --git a/src/SUIT/SUIT_DataBrowser.cxx b/src/SUIT/SUIT_DataBrowser.cxx index be6b8b1d6..f470f6397 100644 --- a/src/SUIT/SUIT_DataBrowser.cxx +++ b/src/SUIT/SUIT_DataBrowser.cxx @@ -269,6 +269,39 @@ void SUIT_DataBrowser::setSelected( const DataObjectList& lst, const bool append } } +/*! + \brief Make the view item for specified data object is visible. + \param obj data object +*/ +void SUIT_DataBrowser::ensureVisible( SUIT_DataObject* obj ) +{ + if ( !obj ) + return; + + DataObjectList lst; + lst.append( obj ); + ensureVisible( lst ); +} + +/*! + \brief Make the view items for specified data objects is visible. + \param lst data object list +*/ +void SUIT_DataBrowser::ensureVisible( const DataObjectList& lst ) +{ + QtxTreeView* tv = treeView(); + SUIT_AbstractModel* treeModel = dynamic_cast( model() ); + if ( !tv || !treeModel ) + return; + + for ( DataObjectList::const_iterator it = lst.begin(); it != lst.end(); ++it ) + { + QModelIndex idx = treeModel->index( *it ); + if ( idx.isValid() ) + tv->scrollTo( idx ); + } +} + /*! \brief Add custom actions to the popup menu. \param menu popup menu diff --git a/src/SUIT/SUIT_DataBrowser.h b/src/SUIT/SUIT_DataBrowser.h index 6807cb953..c7976283e 100644 --- a/src/SUIT/SUIT_DataBrowser.h +++ b/src/SUIT/SUIT_DataBrowser.h @@ -69,6 +69,9 @@ public: void setAutoSizeColumns( const bool on ); void setResizeOnExpandItem( const bool on ); + void ensureVisible( SUIT_DataObject* ); + void ensureVisible( const DataObjectList& ); + protected: virtual void contextMenuEvent( QContextMenuEvent* ); -- 2.39.2