summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI/HeaderView.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-08-26 00:27:17 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-26 00:51:35 +0200
commit9a25dd99c3a32b6f863be7d954d1761a087a889b (patch)
tree09060469270aa7aa34c9e1eaabac5574d8f448bc /Libraries/LibGUI/HeaderView.cpp
parentcfc30b11ba2910e70d4dc42cd6682854231a8a3b (diff)
downloadserenity-9a25dd99c3a32b6f863be7d954d1761a087a889b.zip
LibGUI: HeaderView should always notify parent when sections resize
The view needs to recompute the scrollable content size whenever this happens, so let's always notify it. Previously we were only doing this when resizing columns with interactively (not programmatically.)
Diffstat (limited to 'Libraries/LibGUI/HeaderView.cpp')
-rw-r--r--Libraries/LibGUI/HeaderView.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/Libraries/LibGUI/HeaderView.cpp b/Libraries/LibGUI/HeaderView.cpp
index 31caa71b5b..1f88b20d6c 100644
--- a/Libraries/LibGUI/HeaderView.cpp
+++ b/Libraries/LibGUI/HeaderView.cpp
@@ -60,8 +60,12 @@ HeaderView::~HeaderView()
void HeaderView::set_section_size(int section, int size)
{
auto& data = section_data(section);
+ if (data.size == size)
+ return;
data.size = size;
data.has_initialized_size = true;
+ data.size = size;
+ m_table_view.header_did_change_section_size({}, m_orientation, section, size);
}
int HeaderView::section_size(int section) const
@@ -146,12 +150,7 @@ void HeaderView::mousemove_event(MouseEvent& event)
if (new_size <= minimum_column_size)
new_size = minimum_column_size;
ASSERT(m_resizing_section >= 0 && m_resizing_section < model()->column_count());
- auto& data = this->section_data(m_resizing_section);
- if (data.size != new_size) {
- data.size = new_size;
- m_table_view.header_did_change_section_size({}, m_orientation, m_resizing_section, new_size);
- update();
- }
+ set_section_size(m_resizing_section, new_size);
return;
}