Working with a delegate is a good idea as sugested by MrDeath, here is an example:
void
MouradDelegate
::paint( QPainter* painter,
const QStyleOptionViewItem
& option,
const QModelIndex
& i
) const{
if (option.
showDecorationSelected && (option.
state & QStyle::State_Selected)){ if (option.
state & QStyle::State_Active) // Mourad place here whatever you would like to see when the row is selected and active
painter->fillRect(option.rect, option.palette.highlight().color());
else {
// Mourad place here whatever you would like to see when the row is selected but not active
painter
->fillRect
(option.
rect, p.
color(QPalette::Inactive,
QPalette::Background));
}
}
}
void
MouradDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& i ) const
{
if (option.showDecorationSelected && (option.state & QStyle::State_Selected)){
if (option.state & QStyle::State_Active)
// Mourad place here whatever you would like to see when the row is selected and active
painter->fillRect(option.rect, option.palette.highlight().color());
else {
// Mourad place here whatever you would like to see when the row is selected but not active
QPalette p=option.palette;
painter->fillRect(option.rect, p.color(QPalette::Inactive, QPalette::Background));
}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks