Results 1 to 3 of 3

Thread: delegate editorEvent does not receive enter/leave event

  1. #1
    Join Date
    Mar 2010
    Location
    Heredia, Costa Rica
    Posts
    257
    Thanks
    24
    Thanked 17 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default delegate editorEvent does not receive enter/leave event

    Hi,

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

    This is the code:
    Qt Code:
    1. bool labelDelegate::editorEvent(QEvent *event, QAbstractItemModel *, const QStyleOptionViewItem &, const QModelIndex &)
    2. {
    3. qDebug() << "In editorEvent";
    4. if (event->type() == QEvent::Enter)
    5. {
    6. qDebug() << "Enter";
    7. QCursor cursor(Qt::PointingHandCursor);
    8. QApplication::setOverrideCursor(cursor);
    9. return true;
    10. }
    11. if (event->type() == QEvent::Leave)
    12. {
    13. qDebug() << "Leave";
    14. QCursor cursor(Qt::ArrowCursor);
    15. QApplication::setOverrideCursor(cursor);
    16. return true;
    17. }
    18. return false;
    19. }
    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.

  2. #2
    Join Date
    Apr 2011
    Location
    Russia
    Posts
    85
    Thanks
    2
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: delegate editorEvent does not receive enter/leave event

    Try set mouseTracking in TRUE

  3. #3
    Join Date
    Mar 2010
    Location
    Heredia, Costa Rica
    Posts
    257
    Thanks
    24
    Thanked 17 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: delegate editorEvent does not receive enter/leave event

    With that I noew get QEvent::MouseMove but not enter/leave

Similar Threads

  1. Replies: 3
    Last Post: 7th August 2015, 12:37
  2. Qt widget enter/leave event
    By bunjee in forum Qt Programming
    Replies: 11
    Last Post: 28th April 2014, 03:09
  3. QGraphicsItem can't receive mouse leave/enter event
    By wshn13 in forum Qt Programming
    Replies: 1
    Last Post: 22nd June 2011, 08:32
  4. Mouse Leave and Tab Key event in Delegate
    By faldzip in forum Qt Programming
    Replies: 0
    Last Post: 30th October 2008, 19:04
  5. Tooltip enter/leave event.
    By bunjee in forum Qt Programming
    Replies: 3
    Last Post: 15th December 2007, 11:46

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.