Currently i am able to drag an item from a QListView into a QTreeView. Now i am trying to visualize the drag and drop, and have run into a problem.

In dragMoveEvent i get a copy of event->answerRect() and then i use it in the paintEvent. See below code.

Qt Code:
  1. void SceneTreeView::paintEvent(QPaintEvent* event) {
  2. QPainter painter(viewport());
  3.  
  4. QModelIndex modelIndex = indexAt(QPoint(dropSite_.x(), dropSite_.y()));
  5. QRect answerRect = visualRect(modelIndex);
  6.  
  7. QBrush brush(Qt::black, Qt::Dense4Pattern);
  8.  
  9. QPen pen;
  10. pen.setWidth(2);
  11. pen.setBrush(brush);
  12.  
  13. painter.setPen(pen);
  14. painter.drawRect(answerRect);
  15.  
  16. QTreeView::paintEvent(event);
  17.  
  18. event->accept();
  19. }
To copy to clipboard, switch view to plain text mode 

This will draw a box around the entire item within the SceneTreeView, but only if the cursor is on the edge of the widget. if i hover the mouse over the middle of the widget, where the actual item is displayed, the box does not update, only when i move it to the right, and approach the border.

thoughts ?