Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extended Selection & Deletion of Path Points (#179)
* Overload `RowRemovalOperation::RemoveRows` to accept a `QModelIndexList` of all selected rows. * Set [QAbstractItemView::ExtendedSelection](https://doc.qt.io/qt-5/qabstractitemview.html#SelectionMode-enum) on Path editor points list view so we can select to delete many points at once. This does not change the fact that there is a current index inside the selection which has the focus if an edit is requested. * Set [QAbstractItemView::SelectRows](https://doc.qt.io/qt-5/qabstractitemview.html#SelectionBehavior-enum) on Path editors points list view so we are actually selecting the entire point, which is similar to GM/LGM and feels less awkward. There is still a current index inside the selected row which has the focus if an edit is requested in a specific column item (aka the field). * Use the new `RowRemovalOperation` overload to bulk delete all the selected points in the path editor. I used [QItemSelectionModel::selectedRows](https://doc.qt.io/qt-5/qitemselectionmodel.html#selectedRows) so that we only delete points where every column (aka the entire row) is selected. This should always be the case since I've also changed the selection behavior to select rows instead of items. * Remove selection after setting the current index, which already does a correct selection. As I've stated, the current index resides in the selection and belongs to the selection model. * Add clarifying comments to the selection update slot about interaction with the above changes. * The selected indexes passed to selection change slot may be empty and yet there is still a selection and so enabling of the delete button now needs to check the global selection model of the points table to determine if anything is selected. It should also check if there are selected rows and not just selected items. * The selected point in the preview area is now the last, most recently selected point in the global, cumulative list selection. * Deleting a point now keeps the same row selected, unless the last point is being deleted. This is how GM and the main Qt examples work with as well. Bounds checking is done against the row count so when the last point is deleted we do go to the previous row.
- Loading branch information