Hi all,
I am trying to implement hovering on QTableview i subclassed QStyledItemDelegate and reimplemented paint as show in the below code
i am not able to get hovering properly for the total row
the same code is working fine with QTreeview.


void Delegate:aint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const
{
if (!index.isValid())
{
return; //early exit
}

const QTableView* const view = dynamic_cast< QTableView* >(this->parent());
Q_ASSERT (NULL != view);
if (NULL == view)
{
return; //another early exit
}

int width = 0;
for (int colIndex = 0; colIndex < TOTAL_COLUMNS; colIndex++)
{
if (!view->isColumnHidden(colIndex))
{
width += view->columnWidth(colIndex);
}
}

const QRect rowRect = option.rect.united(QRect(0, option.rect.top(), width, option.rect.height()));

if (option.state & QStyle::State_Selected)
{
painter->fillRect(option.rect, QColor(110, 161, 241));
}

if(option.state & QStyle::State_MouseOver)
{
painter->fillRect(rowRect ,QColor(191, 205, 228));
}


QString dispText;
QRect textRect = option.rect.adjusted(4, 3, 0, 0);
QString text = displayText( index.data(), view ? view->locale() : QLocale() );

switch(index.column())
{
case COL_1:
{

dispText = option.fontMetrics.elidedText(text, Qt::ElideRight, textRect.width());
painter->drawText(textRect, Qt::AlignAbsolute, tr("%1 ").arg(dispText));

}
break;
case COL_2:
{
}