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


C++ QListView::hasFocus方法代码示例

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


在下文中一共展示了QListView::hasFocus方法的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() ) );


}
开发者ID:py1668,项目名称:xpracman-qt2-final,代码行数:61,代码来源:qmvedit.cpp


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