summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-12-17 00:50:37 +0100
committerAndreas Kling <kling@serenityos.org>2020-12-17 00:54:58 +0100
commit598efa60a3554b7e2e9af3b7acde7cfc12b61f13 (patch)
tree26ff13558db366882b105751bf2ea258b64ddeac
parentf0138fcb25cbcd865cb4514bb60ab278a93f9f09 (diff)
downloadserenity-598efa60a3554b7e2e9af3b7acde7cfc12b61f13.zip
LibGUI: Table views with SelectRows should scroll entire rows into view
-rw-r--r--Libraries/LibGUI/AbstractTableView.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/Libraries/LibGUI/AbstractTableView.cpp b/Libraries/LibGUI/AbstractTableView.cpp
index 3095778a07..fdb5872029 100644
--- a/Libraries/LibGUI/AbstractTableView.cpp
+++ b/Libraries/LibGUI/AbstractTableView.cpp
@@ -240,7 +240,16 @@ void AbstractTableView::move_cursor_relative(int vertical_steps, int horizontal_
void AbstractTableView::scroll_into_view(const ModelIndex& index, bool scroll_horizontally, bool scroll_vertically)
{
- ScrollableWidget::scroll_into_view(content_rect(index), scroll_horizontally, scroll_vertically);
+ Gfx::IntRect rect;
+ switch (selection_behavior()) {
+ case SelectionBehavior::SelectItems:
+ rect = content_rect(index);
+ break;
+ case SelectionBehavior::SelectRows:
+ rect = row_rect(index.row());
+ break;
+ }
+ ScrollableWidget::scroll_into_view(rect, scroll_horizontally, scroll_vertically);
}
void AbstractTableView::context_menu_event(ContextMenuEvent& event)