I created a delegate and need to recognize mouseOver state to build an effect. But it does not work.
When I my table appears, the output is like this
When i move the mouse over the table, the output is like this
I don't see the state MouseOver. How can I recognize it?
void TableDelegate::paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const
{
qDebug() << option.state;
if ( option.state == QStyle::State_MouseOver )
{
painter->fillRect( option.rect, QColor( 249, 126, 18 ) );
}
}
OK, it takes me a while to find out that i need to add this line to my myTable.cpp
myTable->viewport()->setAttribute( Qt::WA_Hover );