74  const bool isEditSelection = mEditSelectionModel && mEditSelectionModel->isSelected( mListModel->
mapToMaster( index ) );
 
   76  QStyleOptionViewItem textOption = option;
 
   77  textOption.state |= QStyle::State_Enabled;
 
   78  if ( isEditSelection )
 
   80    textOption.state |= QStyle::State_Selected;
 
   82  drawBackground( painter, textOption, index );
 
   85  static QPixmap sSelectedIcon;
 
   86  if ( sSelectedIcon.isNull() )
 
   88  static QPixmap sDeselectedIcon;
 
   89  if ( sDeselectedIcon.isNull() )
 
   92  const QString text = index.model()->data( index, Qt::EditRole ).toString();
 
   96  const QStyleOptionViewItem iconOption;
 
   98  QRect iconLayoutBounds( option.rect.x(), option.rect.y(), option.rect.height(), option.rect.height() );
 
  100  QPixmap icon = mFeatureSelectionModel->
isSelected( index ) ? sSelectedIcon : sDeselectedIcon;
 
  105    icon = icon.scaledToHeight( option.rect.height(), Qt::SmoothTransformation );
 
  108  drawDecoration( painter, iconOption, iconLayoutBounds, icon );
 
  111  const QVariant conditionalIcon = index.model()->data( index, Qt::DecorationRole );
 
  112  if ( conditionalIcon.isValid() )
 
  114    const QPixmap pixmap = conditionalIcon.value<QPixmap>();
 
  115    iconLayoutBounds.moveLeft( iconLayoutBounds.x() + icon.width() + QFontMetrics( textOption.font ).horizontalAdvance( 
'X' ) );
 
  116    iconLayoutBounds.setTop( option.rect.y() + ( option.rect.height() - pixmap.height() ) / 2.0 );
 
  117    iconLayoutBounds.setHeight( pixmap.height() );
 
  118    drawDecoration( painter, iconOption, iconLayoutBounds, pixmap );
 
  122  const QRect textLayoutBounds( iconLayoutBounds.x() + iconLayoutBounds.width(), option.rect.y(), option.rect.width() - ( iconLayoutBounds.x() + iconLayoutBounds.width() ), option.rect.height() );
 
  125  const QVariant font = index.model()->data( index, Qt::FontRole );
 
  126  if ( font.isValid() )
 
  128    textOption.font = font.value<QFont>();
 
  130  const QVariant textColor = index.model()->data( index, Qt::ForegroundRole );
 
  131  if ( textColor.isValid() )
 
  133    textOption.palette.setColor( QPalette::Text, textColor.value<QColor>() );
 
  136  if ( featInfo.
isNew )
 
  138    textOption.font.setStyle( QFont::StyleItalic );
 
  139    textOption.palette.setColor( QPalette::Text, Qt::darkGreen );
 
  140    textOption.palette.setColor( QPalette::HighlightedText, Qt::darkGreen );
 
  142  else if ( featInfo.
isEdited || ( mCurrentFeatureEdited && isEditSelection ) )
 
  144    textOption.font.setStyle( QFont::StyleItalic );
 
  145    textOption.palette.setColor( QPalette::Text, Qt::red );
 
  146    textOption.palette.setColor( QPalette::HighlightedText, Qt::red );
 
  149  drawDisplay( painter, textOption, textLayoutBounds, text );