Auto scroll to constraint on click (#18859)
* Auto scroll to constraint on click When clicking on a contrasint in Sketcher, that constraint is now automatically scrolled to in the Constraints listview. If selecting multiple constraints, the last one is scrolled to. Closes #17361 * Check model() for nullptr * scrollTo only on select, not de-select #18859
This commit is contained in:
@@ -1371,6 +1371,10 @@ void TaskSketcherConstraints::onSelectionChanged(const Gui::SelectionChanges& ms
|
||||
auto tmpBlock = ui->listWidgetConstraints->blockSignals(true);
|
||||
item->setSelected(select);
|
||||
ui->listWidgetConstraints->blockSignals(tmpBlock);
|
||||
if (select && ui->listWidgetConstraints->model()) { // scrollTo only on select, not de-select
|
||||
QModelIndex index = ui->listWidgetConstraints->model()->index(i, 0);
|
||||
ui->listWidgetConstraints->scrollTo(index, QAbstractItemView::PositionAtCenter);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user