}
}
+/*!
+ \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<SUIT_AbstractModel*>( 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
public:
SUIT_DataBrowser( QWidget* = 0 );
SUIT_DataBrowser( SUIT_DataObject*, QWidget* = 0 );
- ~SUIT_DataBrowser();
+ virtual ~SUIT_DataBrowser();
virtual QString popupClientType() const;
void setAutoSizeColumns( const bool on );
void setResizeOnExpandItem( const bool on );
+ void ensureVisible( SUIT_DataObject* );
+ void ensureVisible( const DataObjectList& );
+
protected:
virtual void contextMenuEvent( QContextMenuEvent* );