Skip to content

Commit

Permalink
Auto scroll to constraint on click (FreeCAD#18859)
Browse files Browse the repository at this point in the history
* 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 FreeCAD#17361

* Check model() for nullptr

* scrollTo only on select, not de-select FreeCAD#18859
  • Loading branch information
Beep6581 authored Jan 21, 2025
1 parent 1ae8524 commit a1f5d36
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit a1f5d36

Please sign in to comment.