本文整理汇总了C++中QListView::currentItem方法的典型用法代码示例。如果您正苦于以下问题:C++ QListView::currentItem方法的具体用法?C++ QListView::currentItem怎么用?C++ QListView::currentItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListView
的用法示例。
在下文中一共展示了QListView::currentItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintCell
// Reimplemented
void QmvItem::paintCell( QPainter *p, const QColorGroup &cg,
int column, int width, int alignment )
{
QListView *listview = listView();
QColorGroup g( cg );
g.setColor( QColorGroup::Base, backgroundColor() );
g.setColor( QColorGroup::Foreground, Qt::black );
g.setColor( QColorGroup::Text, Qt::black );
int indent = 0;
if ( column == 0 ) {
indent = 20 + (shuttletupleattribute ? 20 : 0 );
p->fillRect( 0, 0, width, height(), backgroundColor() );
p->save();
p->translate( indent, 0 );
}
if ( isChanged() && column == 0 ) {
p->save();
QFont f = p->font();
f.setBold( TRUE );
p->setFont( f );
}
if ( !hasCustomContents() || column != 1 ) {
QListViewItem::paintCell( p, g, column, width - indent, alignment );
} else {
p->fillRect( 0, 0, width, height(), backgroundColor() );
drawCustomContents( p, QRect( 0, 0, width, height() ) );
}
if ( isChanged() && column == 0 )
p->restore();
if ( column == 0 )
p->restore();
// Draw +/- open/close control icon on tuple items
if ( !shuttletupleattribute && column == 0 ) {
p->save();
p->setPen( cg.foreground() );
p->setBrush( cg.base() );
p->drawRect( 5, height() / 2 - 4, 9, 9 );
p->drawLine( 7, height() / 2, 11, height() / 2 );
if ( !isOpen() )
p->drawLine( 9, height() / 2 - 2, 9, height() / 2 + 2 );
p->restore();
}
p->save();
p->setPen( QPen( cg.dark(), 1 ) );
p->drawLine( 0, height() - 1, width, height() - 1 );
p->drawLine( width - 1, 0, width - 1, height() );
p->restore();
if ( listview->currentItem() == this && column == 0 &&
!listview->hasFocus() && !listview->viewport()->hasFocus() )
paintFocus( p, cg, QRect( 0, 0, width, height() ) );
}