mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 23:15:08 +00:00
LibGUI: Make AbstractView::set_cursor() scrolling into view optional
Sometimes you just want to set the cursor programmatically without scrolling the view to make the cursor visible.
This commit is contained in:
parent
734035857e
commit
fed53e19c7
2 changed files with 7 additions and 4 deletions
|
@ -423,7 +423,7 @@ void AbstractView::set_key_column_and_sort_order(int column, SortOrder sort_orde
|
|||
update();
|
||||
}
|
||||
|
||||
void AbstractView::set_cursor(ModelIndex index, SelectionUpdate selection_update)
|
||||
void AbstractView::set_cursor(ModelIndex index, SelectionUpdate selection_update, bool scroll_cursor_into_view)
|
||||
{
|
||||
if (m_cursor_index == index)
|
||||
return;
|
||||
|
@ -442,8 +442,11 @@ void AbstractView::set_cursor(ModelIndex index, SelectionUpdate selection_update
|
|||
// FIXME: Support the other SelectionUpdate types
|
||||
|
||||
m_cursor_index = index;
|
||||
// FIXME: We should scroll into view both vertically *and* horizontally.
|
||||
scroll_into_view(index, false, true);
|
||||
|
||||
if (scroll_cursor_into_view) {
|
||||
// FIXME: We should scroll into view both vertically *and* horizontally.
|
||||
scroll_into_view(index, false, true);
|
||||
}
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue