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

Spreadsheet example hangs when select and drag header along with cell data

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • 6.8.1, 6.9.0 FF
    • 6.8
    • Examples and Demos
    • None
    • All
    • 1e02f013a (dev), 1041ae39a (6.8)

    Description

      Click on the header of the spreadsheet so that it selects all the cells of the column along with the header and drag it (along the y axis) over the area between the header and selected cells. Its possible to drag until certain point but beyond that the application hangs.

      Initial debugging shows that its in infinite loop, as the setHighlight() been called during position change in the drop area would possibly be the reason. 

       

       

      // code placeholder
      onPositionChanged: {
                                  const position = Qt.point(dragArea.mouseX, dragArea.mouseY)
                                  // cell is the cell that currently mouse is over it
                                  const cell = tableView.cellAtPosition(position, true)
                                  // dropCell is the cell that it was under the mouse's last position
                                  // if the last and current cells are the same, then there is no need
                                  // to update highlight, as nothing is changed since last time.
                                  if (cell === dropCell)
                                      return
                                  // if something is changed, it means that if the current cell is changed,
                                  // then clear highlighted cells and update the dropCell.
                                  tableView.model.clearHighlight()
                                  dropCell = cell
                                  // if the current cell was invalid (mouse is out side of the TableView)
                                  // then no need to update highlight
                                  if (cell.x < 0 || cell.y < 0)
                                      return
                                  // if dragged cell is the same as the (possibly) dropCell
                                  // then no need to highlight any cells
                                  if (dragArea.dragCell === dropCell)
                                      return
                                  // if the dropCell is not the same as the dragging cell and also
                                  // is not the same as the cell at the mouse's last position
                                  // then highlights the target cells
                                  for (let i in _spreadSelectionModel.selectedIndexes) {
                                      const old_index = _spreadSelectionModel.selectedIndexes[i]
                                      let cell = tableView.cellAtIndex(old_index)
                                      cell.x += dropCell.x - dragArea.dragCell.x
                                      cell.y += dropCell.y - dragArea.dragCell.y
                                      const new_index = tableView.index(cell.y, cell.x)
                                      tableView.model.setHighlight(new_index, true)
                                  }
                              } 

       

       

      Attachments

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

        Activity

          People

            mhqanbari MohammadHossein Qanbari
            santhoshkumar Santhosh Kumar Selvaraj
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes