本文整理汇总了C++中SourceTreeItem::source方法的典型用法代码示例。如果您正苦于以下问题:C++ SourceTreeItem::source方法的具体用法?C++ SourceTreeItem::source怎么用?C++ SourceTreeItem::source使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SourceTreeItem
的用法示例。
在下文中一共展示了SourceTreeItem::source方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rowCount
bool
SourcesModel::removeItem( const source_ptr& source )
{
// qDebug() << "Removing source item from SourceTree:" << source->username();
QModelIndex idx;
int rows = rowCount();
for ( int row = 0; row < rows; row++ )
{
QModelIndex idx = index( row, 0 );
SourceTreeItem* item = indexToTreeItem( idx );
if ( item )
{
if ( item->source() == source )
{
qDebug() << "Found removed source item:" << item->source()->userName();
invisibleRootItem()->removeRow( row );
onItemOffline( idx );
delete item;
return true;
}
}
}
return false;
}
示例2: sourceModel
bool
SourcesProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const
{
if ( !m_filtered )
return true;
SourceTreeItem* sti = m_model->indexToTreeItem( sourceModel()->index( sourceRow, 0, sourceParent ) );
if ( sti )
{
if ( sti->source().isNull() || sti->source()->isOnline() )
return true;
}
return false;
}
示例3: QModelIndex
QModelIndex
SourcesModel::collectionToIndex( const Tomahawk::collection_ptr& collection )
{
for ( int i = 0; i < rowCount(); i++ )
{
QModelIndex idx = index( i, 0 );
SourcesModel::SourceType type = SourcesModel::indexType( idx );
if ( type == SourcesModel::CollectionSource )
{
SourceTreeItem* sti = SourcesModel::indexToTreeItem( idx );
if ( sti && !sti->source().isNull() && sti->source()->collection().data() == collection.data() )
return idx;
}
}
return QModelIndex();
}
示例4: if
void
SourceTreeView::onItemActivated( const QModelIndex& index )
{
if ( !index.isValid() )
return;
SourcesModel::SourceType type = SourcesModel::indexType( index );
if ( type == SourcesModel::CollectionSource )
{
SourceTreeItem* item = SourcesModel::indexToTreeItem( index );
if ( item )
{
if ( item->source().isNull() )
{
PlaylistManager::instance()->showSuperCollection();
}
else
{
qDebug() << "SourceTreeItem toggled:" << item->source()->userName();
PlaylistManager::instance()->show( item->source()->collection() );
}
}
}
else if ( type == SourcesModel::PlaylistSource )
{
playlist_ptr playlist = SourcesModel::indexToPlaylist( index );
if ( !playlist.isNull() )
{
qDebug() << "Playlist activated:" << playlist->title();
PlaylistManager::instance()->show( playlist );
}
}
else if ( type == SourcesModel::DynamicPlaylistSource )
{
dynplaylist_ptr playlist = SourcesModel::indexToDynamicPlaylist( index );
if ( !playlist.isNull() )
{
qDebug() << "Dynamic Playlist activated:" << playlist->title();
PlaylistManager::instance()->show( playlist );
}
}
}
示例5: dataChanged
void
SourcesModel::onSourceChanged()
{
Source* src = qobject_cast< Source* >( sender() );
for ( int i = 0; i < rowCount(); i++ )
{
QModelIndex idx = index( i, 0 );
if ( indexType( idx ) == CollectionSource )
{
SourceTreeItem* sti = indexToTreeItem( idx );
if ( sti )
{
if ( sti->source().data() == src )
{
emit dataChanged( idx, idx );
}
}
}
}
}