Hi,
I have a custom delegate where I need to handle the mouse enter and leave events.
This is the code:
{
qDebug() << "In editorEvent";
if (event
->type
() == QEvent::Enter) {
qDebug() << "Enter";
QCursor cursor
(Qt
::PointingHandCursor);
return true;
}
if (event
->type
() == QEvent::Leave) {
qDebug() << "Leave";
return true;
}
return false;
}
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;
}
To copy to clipboard, switch view to plain text mode
But the editorEvent does not get any mousemove,enter or leave, only mousepress and mouserelease
Any idea how to do this?
Thanks,
Carlos.
Bookmarks