-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extended Selection & Deletion of Path Points #179
Conversation
Editors/PathEditor.cpp
Outdated
// if new points were added to the selection, select them in the preview | ||
if (!selected.indexes().empty()) selectIndex = selected.indexes()[0].row(); | ||
_ui->roomView->selectedPointIndex = selectIndex; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally and eventually I want these previews to share a selection model with the list views and stuff. The selected points should be the same as those selected in the list so they can be moved together logically. We should also probably be painting the selection using the current style so it's consistent with platform conventions. The views should also maybe maintain a current index with focus indication like QGraphicsView/QGraphicsScene does.
https://doc.qt.io/qt-5/qtwidgets-itemviews-chart-example.html
Editors/PathEditor.cpp
Outdated
@@ -234,15 +238,15 @@ void PathEditor::on_deletePointButton_pressed() { | |||
int deleteIndex = _ui->pointsTableView->selectionModel()->currentIndex().row(); | |||
{ | |||
RepeatedMessageModel::RowRemovalOperation remover(_pointsModel); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought this was going to be a for-loop, now. Write it like this, please:
RepeatedMessageModel::RowRemovalOperation(_pointsModel)
.RemoveRows(_ui->pointsTableView->selectionModel()->selectedRows());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aight 25f71db and it is a for loop, it's a for loop in the class so we don't duplicate it everywhere.
https://github.com/enigma-dev/RadialGM/pull/179/files#diff-9223a9db2dfd4809200a0a8574385ed1R147
01f9cdd
to
25f71db
Compare
RowRemovalOperation::RemoveRows
to accept aQModelIndexList
of all selected rows.RowRemovalOperation
overload to bulk delete all the selected points in the path editor. I used QItemSelectionModel::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.Understand that I am still not entirely sure the interaction of this with the current index. It seems that it is possible for the current index (which has the focus?) to reside outside of the selection if we deselect the current index. I am not sure how this interacts with QTreeView::allColumnsShowFocus but I suspect it's related. Regardless, other than being weird and not sure of the expected behavior, it doesn't seem to cause any issues.