10 #include <QPushButton>
12 #include <QApplication>
13 #include <QMouseEvent>
17 : QItemDelegate( parent )
18 , mFeatureSelectionModel( NULL )
19 , mListModel( listModel )
48 return QSize( option.rect.width(),
sIconSize );
53 QString text = index.model()->data( index, Qt::EditRole ).toString();
58 QStyleOptionViewItem iconOption;
60 QRect iconLayoutBounds( option.rect.x(), option.rect.y(), option.rect.height(), option.rect.height() );
75 QRect textLayoutBounds( iconLayoutBounds.x() + iconLayoutBounds.width(), option.rect.y(), option.rect.width() - ( iconLayoutBounds.x() + iconLayoutBounds.width() ), option.rect.height() );
77 QStyleOptionViewItem textOption;
78 textOption.state |= QStyle::State_Enabled;
81 textOption.state |= QStyle::State_Selected;
86 textOption.font.setStyle( QFont::StyleItalic );
87 textOption.palette.setColor( QPalette::Text, Qt::darkGreen );
88 textOption.palette.setColor( QPalette::HighlightedText, Qt::darkGreen );
90 else if ( featInfo.
isEdited || isEdited )
92 textOption.font.setStyle( QFont::StyleItalic );
93 textOption.palette.setColor( QPalette::Text, Qt::red );
94 textOption.palette.setColor( QPalette::HighlightedText, Qt::red );
97 drawDisplay( painter, textOption, textLayoutBounds, text );
98 drawDecoration( painter, iconOption, iconLayoutBounds, icon );