PDA

View Full Version : delegate editorEvent does not receive enter/leave event



qlands
11th August 2011, 10:37
Hi,

I have a custom delegate where I need to handle the mouse enter and leave events.

This is the code:


bool labelDelegate::editorEvent(QEvent *event, QAbstractItemModel *, const QStyleOptionViewItem &, const QModelIndex &)
{
qDebug() << "In editorEvent";
if (event->type() == QEvent::Enter)
{
qDebug() << "Enter";
QCursor cursor(Qt::PointingHandCursor);
QApplication::setOverrideCursor(cursor);
return true;
}
if (event->type() == QEvent::Leave)
{
qDebug() << "Leave";
QCursor cursor(Qt::ArrowCursor);
QApplication::setOverrideCursor(cursor);
return true;
}
return false;
}


But the editorEvent does not get any mousemove,enter or leave, only mousepress and mouserelease

Any idea how to do this?

Thanks,
Carlos.

Jonny174
11th August 2011, 10:49
Try set mouseTracking in TRUE

qlands
11th August 2011, 10:55
With that I noew get QEvent::MouseMove but not enter/leave