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

Details

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

    Description

      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

      Attachments

        For Gerrit Dashboard: QTBUG-130045
        # Subject Branch Project Status CR V

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes