当前位置: 首页>>代码示例>>C++>>正文


C++ SourceTreeItem::source方法代码示例

本文整理汇总了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;
}
开发者ID:tiegz,项目名称:tomahawk,代码行数:28,代码来源:sourcesmodel.cpp

示例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;
}
开发者ID:LittleForker,项目名称:tomahawk,代码行数:15,代码来源:sourcesproxymodel.cpp

示例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();
}
开发者ID:tiegz,项目名称:tomahawk,代码行数:17,代码来源:sourcesmodel.cpp

示例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 );
        }
    }
}
开发者ID:hatstand,项目名称:tomahawk,代码行数:45,代码来源:sourcetreeview.cpp

示例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 );
                }
            }
        }
    }
}
开发者ID:tiegz,项目名称:tomahawk,代码行数:22,代码来源:sourcesmodel.cpp


注:本文中的SourceTreeItem::source方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。