本文整理汇总了C++中QueueItem::unlistenedCount方法的典型用法代码示例。如果您正苦于以下问题:C++ QueueItem::unlistenedCount方法的具体用法?C++ QueueItem::unlistenedCount怎么用?C++ QueueItem::unlistenedCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueueItem
的用法示例。
在下文中一共展示了QueueItem::unlistenedCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
if ( option.rect.height() == 0 )
return;
QStyleOptionViewItemV4 optIndentation = option;
QStyleOptionViewItemV4 opt = option;
painter->save();
painter->setRenderHint( QPainter::TextAntialiasing );
painter->setRenderHint( QPainter::SmoothPixmapTransform );
const bool selected = ( option.state & QStyle::State_Selected ) == QStyle::State_Selected;
if ( selected )
painter->setOpacity( 1.0 );
else
painter->setOpacity( 0.7 );
SourcesModel::RowType type = static_cast< SourcesModel::RowType >( index.data( SourcesModel::SourceTreeItemTypeRole ).toInt() );
SourceTreeItem* item = index.data( SourcesModel::SourceTreeItemRole ).value< SourceTreeItem* >();
Q_ASSERT( item );
initStyleOption( &opt, index );
opt.icon = QIcon();
opt.text.clear();
// shrink the indentations
{
int indentMult = 0;
QModelIndex counter = index;
while ( counter.parent().isValid() )
{
indentMult++;
counter = counter.parent();
}
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 );
//.........这里部分代码省略.........