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.
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.