Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to implement the editor directly in the delegate?

How to implement the editor directly in the delegate?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 656 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SuJinQt
    wrote on last edited by
    #1

    Hi All:
    I am a newbie of Qt and I am learning the "star delegate example":http://qt-project.org/doc/qt-5/qtwidgets-itemviews-stardelegate-example.html, I do not understand that "By reimplementing QAbstractItemDelegate::editorEvent(), it is possible to implement the editor directly in the delegate, instead of creating a separate QWidget subclass." at the end of "Possible Extensions and Suggestions". Can anyone please show me how to implement it? Thanks very much.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SuJinQt
      wrote on last edited by
      #2

      After some more testing, I found that by doing fallowing things:

      some code of starEditor mouseMoveEvent ---> delegate editorEvent and event->type== QMouseEvent::mouseMove;

      some code of StarRating paint ----> delegate paint;

      view->setMouseTracking(true);

      emit sizeHintChanged to force view to repaint when needed;

      I got similar things with "star delegate example":http://qt-project.org/doc/qt-5/qtwidgets-itemviews-stardelegate-example.html, but I can't exit the Eitable mode, because I can't detect when mouse leaving the item. Any help would be appreciate. And sorry for my poor English.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved