Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-7107

QAbstractItemView showDropIndicator property does not work (exhibited in the Puzzles example)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P3: Somewhat important
    • Some future release
    • 4.5.3, 4.6.0
    • Widgets: Itemviews
    • 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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            dedietri Gabriel de Dietrich (drgvond)
            rryan RJ Ryan
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes