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());
  4. QModelIndex modelIndex = indexAt(QPoint(dropSite_.x(), dropSite_.y()));
  5. QRect answerRect = visualRect(modelIndex);
  7. QBrush brush(Qt::black, Qt::Dense4Pattern);
  9. QPen pen;
  10. pen.setWidth(2);
  11. pen.setBrush(brush);
  13. painter.setPen(pen);
  14. painter.drawRect(answerRect);
  16. QTreeView::paintEvent(event);
  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 ?