本文整理汇总了C++中TreeModel::addCollection方法的典型用法代码示例。如果您正苦于以下问题:C++ TreeModel::addCollection方法的具体用法?C++ TreeModel::addCollection怎么用?C++ TreeModel::addCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeModel
的用法示例。
在下文中一共展示了TreeModel::addCollection方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TreeWidget
Tomahawk::ViewPage*
ViewManager::show( const Tomahawk::collection_ptr& collection )
{
m_currentCollection = collection;
TreeWidget* widget;
if ( !m_treeWidgets.contains( collection ) || m_treeWidgets.value( collection ).isNull() )
{
widget = new TreeWidget();
widget->view()->proxyModel()->setStyle( PlayableProxyModel::Collection );
TreeModel* model = new TreeModel();
widget->view()->setTreeModel( model );
if ( !collection.isNull() )
widget->view()->setEmptyTip( collection->emptyText() );
model->addCollection( collection );
m_treeWidgets.insert( collection, widget );
}
else
{
widget = m_treeWidgets.value( collection ).data();
}
setPage( widget );
return widget;
}
示例2: TreeModel
void
CollectionViewPage::onCollectionChanged()
{
TreeModel* model = new TreeModel();
PlayableModel* flatModel = new PlayableModel();
PlayableModel* albumModel = new PlayableModel();
setTreeModel( model );
setFlatModel( flatModel );
setAlbumModel( albumModel );
model->addCollection( m_collection );
flatModel->appendTracks( m_collection );
albumModel->appendAlbums( m_collection );
if ( m_collection && m_collection->source() && m_collection->source()->isLocal() )
{
setEmptyTip( tr( "After you have scanned your music collection you will find your tracks right here." ) );
}
else
setEmptyTip( tr( "This collection is empty." ) );
if ( m_collection.objectCast<ScriptCollection>() )
m_trackView->setEmptyTip( tr( "Cloud collections aren't supported in the flat view yet. We will have them covered soon. Switch to another view to navigate them." ) );
}
示例3: FlexibleTreeView
Tomahawk::ViewPage*
ViewManager::show( const Tomahawk::collection_ptr& collection )
{
m_currentCollection = collection;
FlexibleTreeView* view;
if ( !m_collectionViews.contains( collection ) || m_collectionViews.value( collection ).isNull() )
{
view = new FlexibleTreeView();
view->columnView()->proxyModel()->setStyle( PlayableProxyModel::Collection );
TreeModel* model = new TreeModel();
view->setTreeModel( model );
model->addCollection( collection );
setPage( view );
if ( !collection.isNull() )
view->setEmptyTip( collection->emptyText() );
m_collectionViews.insert( collection, view );
}
else
{
view = m_collectionViews.value( collection ).data();
}
view->restoreViewMode();
setPage( view );
return view;
}
示例4: TreeView
Tomahawk::ViewPage*
ViewManager::show( const Tomahawk::collection_ptr& collection )
{
m_currentCollection = collection;
TreeView* view;
if ( !m_treeViews.contains( collection ) || m_treeViews.value( collection ).isNull() )
{
view = new TreeView();
view->proxyModel()->setStyle( PlayableProxyModel::Collection );
TreeModel* model = new TreeModel();
view->setTreeModel( model );
if ( collection && collection->source()->isLocal() )
view->setEmptyTip( tr( "After you have scanned your music collection you will find your tracks right here." ) );
else
view->setEmptyTip( tr( "This collection is empty." ) );
model->addCollection( collection );
m_treeViews.insert( collection, view );
}
else
{
view = m_treeViews.value( collection ).data();
}
setPage( view );
return view;
}
示例5: TreeModel
void
CollectionViewPage::onCollectionChanged()
{
TreeModel* model = new TreeModel();
PlayableModel* flatModel = new PlayableModel();
PlayableModel* albumModel = new PlayableModel();
setTreeModel( model );
setFlatModel( flatModel );
setAlbumModel( albumModel );
model->addCollection( m_collection );
flatModel->appendTracks( m_collection );
albumModel->appendAlbums( m_collection );
if ( m_collection && m_collection->isLocal() )
{
setEmptyTip( tr( "After you have scanned your music collection you will find your tracks right here." ) );
}
else
setEmptyTip( tr( "This collection is empty." ) );
}
示例6: numSourcesChanged
Tomahawk::ViewPage*
ViewManager::show( const Tomahawk::collection_ptr& collection )
{
qDebug() << Q_FUNC_INFO << m_currentMode;
m_currentCollection = collection;
ViewPage* shown = 0;
if ( m_currentMode == PlaylistModes::Flat )
{
/* CollectionView* view;
if ( !m_collectionViews.contains( collection ) || m_collectionViews.value( collection ).isNull() )
{
view = new CollectionView();
CollectionFlatModel* model = new CollectionFlatModel();
view->setPlayableModel( model );
model->addCollection( collection );
m_collectionViews.insert( collection, view );
}
else
{
view = m_collectionViews.value( collection ).data();
}
shown = view;
setPage( view );*/
}
if ( m_currentMode == PlaylistModes::Tree )
{
TreeView* view;
if ( !m_treeViews.contains( collection ) || m_treeViews.value( collection ).isNull() )
{
view = new TreeView();
TreeModel* model = new TreeModel();
view->setTreeModel( model );
if ( collection && collection->source()->isLocal() )
view->setEmptyTip( tr( "After you have scanned your music collection you will find your tracks right here." ) );
else
view->setEmptyTip( tr( "This collection is empty." ) );
model->addCollection( collection );
m_treeViews.insert( collection, view );
}
else
{
view = m_treeViews.value( collection ).data();
}
shown = view;
setPage( view );
}
if ( m_currentMode == PlaylistModes::Album )
{
GridView* aview;
if ( !m_collectionGridViews.contains( collection ) || m_collectionGridViews.value( collection ).isNull() )
{
aview = new GridView();
AlbumModel* amodel = new AlbumModel( aview );
aview->setPlayableModel( amodel );
amodel->addCollection( collection );
m_collectionGridViews.insert( collection, aview );
}
else
{
aview = m_collectionGridViews.value( collection ).data();
}
shown = aview;
setPage( aview );
}
emit numSourcesChanged( 1 );
return shown;
}
示例7: numSourcesChanged
Tomahawk::ViewPage*
ViewManager::show( const Tomahawk::collection_ptr& collection )
{
qDebug() << Q_FUNC_INFO << m_currentMode;
m_currentCollection = collection;
ViewPage* shown = 0;
if ( m_currentMode == PlaylistInterface::Flat )
{
CollectionView* view;
if ( !m_collectionViews.contains( collection ) )
{
view = new CollectionView();
CollectionFlatModel* model = new CollectionFlatModel();
view->setTrackModel( model );
view->setFrameShape( QFrame::NoFrame );
view->setAttribute( Qt::WA_MacShowFocusRect, 0 );
model->addCollection( collection );
m_collectionViews.insert( collection, view );
}
else
{
view = m_collectionViews.value( collection );
}
shown = view;
setPage( view );
}
if ( m_currentMode == PlaylistInterface::Tree )
{
ArtistView* view;
if ( !m_treeViews.contains( collection ) )
{
view = new ArtistView();
TreeModel* model = new TreeModel();
view->setTreeModel( model );
view->setFrameShape( QFrame::NoFrame );
view->setAttribute( Qt::WA_MacShowFocusRect, 0 );
model->addCollection( collection );
m_treeViews.insert( collection, view );
}
else
{
view = m_treeViews.value( collection );
}
shown = view;
setPage( view );
}
if ( m_currentMode == PlaylistInterface::Album )
{
AlbumView* aview;
if ( !m_collectionAlbumViews.contains( collection ) )
{
aview = new AlbumView();
AlbumModel* amodel = new AlbumModel( aview );
aview->setAlbumModel( amodel );
aview->setFrameShape( QFrame::NoFrame );
aview->setAttribute( Qt::WA_MacShowFocusRect, 0 );
amodel->addCollection( collection );
m_collectionAlbumViews.insert( collection, aview );
}
else
{
aview = m_collectionAlbumViews.value( collection );
}
shown = aview;
setPage( aview );
}
emit numSourcesChanged( 1 );
return shown;
}