mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 08:39:22 +00:00
LibGUI: Scroll selected treeview entries into view
This commit is contained in:
parent
cb9d9846e0
commit
0086daf9b0
Notes:
sideshowbarker
2024-07-19 09:05:10 +09:00
Author: https://github.com/xTibor
Commit: 0086daf9b0
Pull-request: https://github.com/SerenityOS/serenity/pull/1287
1 changed files with 7 additions and 1 deletions
|
@ -386,6 +386,7 @@ void TreeView::keydown_event(KeyEvent& event)
|
||||||
});
|
});
|
||||||
if (found_index.is_valid()) {
|
if (found_index.is_valid()) {
|
||||||
selection().set(found_index);
|
selection().set(found_index);
|
||||||
|
scroll_into_view(selection().first(), Orientation::Vertical);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -401,8 +402,11 @@ void TreeView::keydown_event(KeyEvent& event)
|
||||||
previous_index = index;
|
previous_index = index;
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
});
|
});
|
||||||
if (found_index.is_valid())
|
if (found_index.is_valid()) {
|
||||||
selection().set(found_index);
|
selection().set(found_index);
|
||||||
|
scroll_into_view(selection().first(), Orientation::Vertical);
|
||||||
|
update();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,6 +427,7 @@ void TreeView::keydown_event(KeyEvent& event)
|
||||||
}
|
}
|
||||||
if (cursor_index.is_valid() && cursor_index.parent().is_valid()) {
|
if (cursor_index.is_valid() && cursor_index.parent().is_valid()) {
|
||||||
selection().set(cursor_index.parent());
|
selection().set(cursor_index.parent());
|
||||||
|
scroll_into_view(selection().first(), Orientation::Vertical);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -436,6 +441,7 @@ void TreeView::keydown_event(KeyEvent& event)
|
||||||
}
|
}
|
||||||
|
|
||||||
selection().set(model()->index(0, model()->tree_column(), cursor_index));
|
selection().set(model()->index(0, model()->tree_column(), cursor_index));
|
||||||
|
scroll_into_view(selection().first(), Orientation::Vertical);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue