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

QTableView: there's a single pixel line between cells where dropping is handled as if on viewport

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3: Somewhat important P3: Somewhat important
    • 6.8.1, 6.9.0 FF
    • 6.8.0
    • Widgets: Itemviews
    • None
    • All
    • f9336a05b (dev), dcea42ea5 (6.8)

      When dragging something between two tableview rows, there's a single Y position where instead of dropping there between the items, the drop will react as if it happened on the viewport, which might either append the item to the end, or, in my testcase, just lose the item completely and leave an empty row instead.

      This is because of the code in QAIVPrivate::dropOn() which says

              if (!index.isValid() || !q->visualRect(index).contains(event->position().toPoint()))
                  index = root;

      In the case of QTableView, there's a one-pixel horizontal line between two cells where    indexAt(pos) returns a valid index and visualRect(index) doesn't contain pos, because of the 1 pixel cell border.

      The code above is very old (predates public git history) but this probably wasn't detected before because I implemented easier support for moving rows in QTableView/QTableWidget only recently.

      Testcase: qtablewidget-dnd.cpp

        1. drop.png
          drop.png
          145 kB
        2. qtablewidget-dnd.cpp
          3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            dfaure_kdab David Faure
            dfaure_kdab David Faure
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes