Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
6.8
-
None
-
-
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) } }