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


C++ PlaylistItem::collaborative方法代码示例

本文整理汇总了C++中PlaylistItem::collaborative方法的典型用法代码示例。如果您正苦于以下问题:C++ PlaylistItem::collaborative方法的具体用法?C++ PlaylistItem::collaborative怎么用?C++ PlaylistItem::collaborative使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PlaylistItem的用法示例。


在下文中一共展示了PlaylistItem::collaborative方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if


//.........这里部分代码省略.........
        const int indentDelta = optIndentation.rect.x() - m_parent->viewport()->x();
        optIndentation.rect.setX( optIndentation.rect.x() - indentDelta + indentMult * TomahawkUtils::DpiScaler::scaledY( m_parent, TREEVIEW_INDENT_ADD ) );
        opt.rect.setX( 0 );
    }

    if ( type == SourcesModel::Source || type == SourcesModel::ScriptCollection )
    {
        paintSource( painter, optIndentation, index );
    }
    else if ( type == SourcesModel::Group )
    {
        paintGroup( painter, opt, index );
    }
    else if ( type == SourcesModel::Category )
    {
        paintCategory( painter, optIndentation, index );
    }
    else if ( type == SourcesModel::Divider )
    {
        const QRect middle = optIndentation.rect.adjusted( 0, m_margin / 16, 0, -m_margin / 16 );
        const QColor bgcolor = opt.palette.color( QPalette::Base );

        painter->setPen( bgcolor.darker( 120 ) );
        painter->drawLine( middle.topLeft(), middle.topRight() );
        painter->setPen( bgcolor.lighter( 120 ) );
        painter->drawLine( middle.bottomLeft(), middle.bottomRight() );
    }
    else
    {
        optIndentation.state &= ~QStyle::State_MouseOver;
        if ( !index.parent().parent().isValid() )
            optIndentation.rect.adjust( m_margin / 4, 0, 0, 0 );

        if ( type == SourcesModel::Inbox || type == SourcesModel::Queue || type == SourcesModel::Collection )
        {
            QString count;
            if ( type == SourcesModel::Inbox )
            {
                InboxItem* ii = qobject_cast< InboxItem* >( item );
                if ( ii && ii->unlistenedCount() )
                    count = QString::number( ii->unlistenedCount() );
            }
            else if ( type == SourcesModel::Queue )
            {
                QueueItem* qi = qobject_cast< QueueItem* >( item );
                if ( qi && qi->unlistenedCount() )
                    count = QString::number( qi->unlistenedCount() );
            }
            else if ( type == SourcesModel::Collection )
            {
                CollectionItem* ci = qobject_cast< CollectionItem* >( item );
                if ( ci )
                    count = QString::number( ci->trackCount() );
            }

            paintStandardItem( painter, optIndentation, index, count );
        }
        else if ( type == SourcesModel::TemporaryPage || type == SourcesModel::DeletablePage || type == SourcesModel::RemovablePage )
        {
            if ( opt.state & QStyle::State_MouseOver )
            {
                m_iconHeight = ( opt.rect.height() / 2 );
                paintStandardItem( painter, optIndentation, index );

                // draw close icon
                const QRect r( opt.rect.right() - m_margin / 8 - m_iconHeight, opt.rect.y() + ( opt.rect.height() - m_iconHeight ) / 2, m_iconHeight, m_iconHeight );
                painter->drawPixmap( r, TomahawkUtils::defaultPixmap( TomahawkUtils::ListRemove, TomahawkUtils::Original, r.size() ) );
            }
            else
                paintStandardItem( painter, optIndentation, index );
        }
        else if ( type == SourcesModel::StaticPlaylist )
        {
            paintStandardItem( painter, optIndentation, index );

            PlaylistItem* plItem = qobject_cast< PlaylistItem* >( item );
            if ( plItem->canSubscribe() && !plItem->subscribedIcon().isNull() )
            {
                const int imgWidth = optIndentation.rect.height() / 2;
                const QPixmap icon = plItem->subscribedIcon().scaled( imgWidth, imgWidth, Qt::KeepAspectRatio, Qt::SmoothTransformation );
                const QRect subRect( optIndentation.rect.right() - m_margin / 2 - imgWidth, optIndentation.rect.top() + ( optIndentation.rect.height() - imgWidth ) / 2, imgWidth, imgWidth );
                painter->drawPixmap( subRect, icon );
            }

            if ( plItem->collaborative() )
            {
                const int imgWidth = optIndentation.rect.height() / 2;
                const QRect subRect( optIndentation.rect.left(), optIndentation.rect.top(), imgWidth, imgWidth );

                painter->drawPixmap( subRect, TomahawkUtils::defaultPixmap( TomahawkUtils::GreenDot, TomahawkUtils::Original, subRect.size() ) );
            }
        }
        else
            paintStandardItem( painter, optIndentation, index );
    }

    paintDecorations( painter, opt, index );

    painter->restore();
}
开发者ID:AshotN,项目名称:tomahawk,代码行数:101,代码来源:SourceDelegate.cpp


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