Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.5.3, 4.6.0
-
None
-
Ubuntu 9.10 64-bit, Intel Core 2 Duo
Description
In QAbstractItemView, the showDropIndicator should show a drop indicator when enabled.
The Puzzles Qt example found in examples/dragndrop/puzzles has an example of this incorrect behavior. The PiecesList component of the Puzzles example sets showDropIndicator to true, yet the drop indicator is not shown when hovering a puzzle piece over the PiecesList. The drop indicator should be a line or rectangle that indicates where a dragged item will be dropped into an item view.
If I override PiecesList::paintEvent(), I find that while a drag is happening, paintEvent's are not delivered. I can tell that this is specific to the item views because the PuzzleWidget does not exhibit the same behavior. For the PuzzleWidget, paint events are delivered while a drag is occurring.
The log messages emitted while dragging over the PuzzleWidget are interleaved like so:
PuzzleWidget::dragMoveEvent
PuzzleWidget::paintEvent
PuzzleWidget::dragMoveEvent
PuzzleWidget::paintEvent
....
While the log messages emitted while dragging over the PiecesList are only dragMoveEvent's and then a paintEvent after the drop occurs.
...
PiecesList::dragMoveEvent
PiecesList::dragMoveEvent
PiecesList::dragMoveEvent
PiecesList::dragMoveEvent
PiecesList::paintEvent
The various item views (QTableView, QListView, etc) all have provisions for drawing the drop indicator in their respective paintEvent() methods. Each has a set of lines at the end akin to this:
(for QListView)
#ifndef QT_NO_DRAGANDDROP
d->commonListView->paintDragDrop(&painter);
#endif
(for QTableView)
#ifndef QT_NO_DRAGANDDROP
// Paint the dropIndicator
d->paintDropIndicator(&painter);
#endif
It appears to me that the problem is that paint events are not delivered while dragging in item views, while they are delivered in regular QWidgets.