summaryrefslogtreecommitdiff
path: root/LibGUI/GTableView.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-02-28 13:25:52 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-02-28 13:25:52 +0100
commit827ec99a8f891cb491422f9ef63c8bdbc86054b3 (patch)
tree3783b723625b215ffec7ad0a154d66a939391097 /LibGUI/GTableView.cpp
parent82c22a7484cace974a9a14fecd32393452866885 (diff)
downloadserenity-827ec99a8f891cb491422f9ef63c8bdbc86054b3.zip
LibGUI: Update GTableView's scrollbar range in response to resize.
Diffstat (limited to 'LibGUI/GTableView.cpp')
-rw-r--r--LibGUI/GTableView.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/LibGUI/GTableView.cpp b/LibGUI/GTableView.cpp
index 66047c9801..97e1e8a30f 100644
--- a/LibGUI/GTableView.cpp
+++ b/LibGUI/GTableView.cpp
@@ -32,12 +32,18 @@ void GTableView::set_model(OwnPtr<GTableModel>&& model)
void GTableView::resize_event(GResizeEvent& event)
{
m_scrollbar->set_relative_rect(event.size().width() - m_scrollbar->preferred_size().width(), 0, m_scrollbar->preferred_size().width(), event.size().height());
+ update_scrollbar_range();
}
-void GTableView::did_update_model()
+void GTableView::update_scrollbar_range()
{
int excess_height = max(0, (item_count() * item_height()) - height());
m_scrollbar->set_range(0, excess_height);
+}
+
+void GTableView::did_update_model()
+{
+ update_scrollbar_range();
update();
}