From 27e86c03da69507e6c38cb8a7a6384d721dbacf8 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 1 Sep 2020 15:41:56 +0200 Subject: [PATCH] LibGUI: Implement the virtual IconView::scroll_into_view() This is virtual in AbstractView so let's not shadow it with an IconView specific variant. --- Libraries/LibGUI/IconView.cpp | 6 ++++-- Libraries/LibGUI/IconView.h | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Libraries/LibGUI/IconView.cpp b/Libraries/LibGUI/IconView.cpp index 0d92e7fb89..26d3899341 100644 --- a/Libraries/LibGUI/IconView.cpp +++ b/Libraries/LibGUI/IconView.cpp @@ -62,9 +62,11 @@ void IconView::select_all() } } -void IconView::scroll_into_view(const ModelIndex& index, Orientation orientation) +void IconView::scroll_into_view(const ModelIndex& index, bool scroll_horizontally, bool scroll_vertically) { - ScrollableWidget::scroll_into_view(item_rect(index.row()), orientation); + if (!index.is_valid()) + return; + ScrollableWidget::scroll_into_view(item_rect(index.row()), scroll_horizontally, scroll_vertically); } void IconView::resize_event(ResizeEvent& event) diff --git a/Libraries/LibGUI/IconView.h b/Libraries/LibGUI/IconView.h index 2e23f2fcf7..c4ae146e86 100644 --- a/Libraries/LibGUI/IconView.h +++ b/Libraries/LibGUI/IconView.h @@ -41,7 +41,8 @@ public: int content_width() const; int horizontal_padding() const { return m_horizontal_padding; } - void scroll_into_view(const ModelIndex&, Orientation); + virtual void scroll_into_view(const ModelIndex&, bool scroll_horizontally = true, bool scroll_vertically = true) override; + Gfx::IntSize effective_item_size() const { return m_effective_item_size; } int model_column() const { return m_model_column; }