lv->setColumnText( myColumnIds[id], icon, label );
}
+QString OB_Browser::nameTitle() const
+{
+ return myView->columnText( 0 );
+}
+
+QString OB_Browser::columnTitle( const int id ) const
+{
+ QString txt;
+ if ( myColumnIds.contains( id ) )
+ txt = myView->columnText( myColumnIds[id] );
+ return txt;
+}
+
bool OB_Browser::isColumnVisible( const int id ) const
{
return myColumnIds.contains( id ) && myView->isShown( myColumnIds[id] );
return lst;
}
+bool OB_Browser::appropriateColumn( const int id ) const
+{
+ bool res = false;
+ if ( myColumnIds.contains( id ) )
+ res = myView->appropriate( myColumnIds[id] );
+ return res;
+}
+
+void OB_Browser::setAppropriateColumn( const int id, const bool on )
+{
+ if ( !myColumnIds.contains( id ) )
+ return;
+
+ myView->setAppropriate( myColumnIds[id], on );
+}
+
void OB_Browser::updateTree( SUIT_DataObject* o )
{
updateTree( o ? o : getRootObject(), false );
updateTree( 0, true );
}
+void OB_Browser::onColumnVisible( int id )
+{
+ setColumnShown( id, !isColumnVisible( id ) );
+}
+
void OB_Browser::onDestroyed( SUIT_DataObject* obj )
{
removeObject( obj );
void OB_Browser::contextMenuPopup( QPopupMenu* menu )
{
+ QValueList<int> cols;
+ for ( QMap<int, int>::ConstIterator it = myColumnIds.begin(); it != myColumnIds.end(); ++it )
+ {
+ if ( appropriateColumn( it.key() ) )
+ cols.append( it.key() );
+ }
+
+ uint num = menu->count();
+ menu->setCheckable( true );
+ for ( QValueList<int>::const_iterator iter = cols.begin(); iter != cols.end(); ++iter )
+ {
+ QString name = columnTitle( *iter );
+ if ( name.isEmpty() )
+ continue;
+
+ int id = menu->insertItem( name, this, SLOT( onColumnVisible( int ) ) );
+ menu->setItemChecked( id, isColumnVisible( *iter ) );
+ menu->setItemParameter( id, *iter );
+ }
+ if ( menu->count() != num )
+ menu->insertSeparator();
+
DataObjectList selected;
getSelected( selected );
void setColumnTitle( const int id, const QString& );
virtual void setColumnTitle( const int id, const QIconSet&, const QString& );
+ QString nameTitle() const;
+ QString columnTitle( const int ) const;
+
bool isColumnVisible( const int ) const;
virtual void setColumnShown( const int, const bool );
QValueList<int> columns() const;
+ bool appropriateColumn( const int ) const;
+ virtual void setAppropriateColumn( const int, const bool );
+
virtual bool eventFilter(QObject* watched, QEvent* e);
QListView* listView() const;
private slots:
void onExpand();
void onRefresh();
+ void onColumnVisible( int );
void onDestroyed( SUIT_DataObject* );
void onDropped( QPtrList<QListViewItem>, QListViewItem*, int );