From 472a3df03bbf0fe4ef2f2f99a92ed395a8cd739f Mon Sep 17 00:00:00 2001 From: martinfalisse Date: Sat, 9 Apr 2022 19:39:56 +0200 Subject: [PATCH] LibGUI: Calculate width of table headers when there is no content In order to correctly calculate the width of the header add the top left x coordinate + the width of the content. Previously was using the width returned by the visible_content_rect(), which when there was no content would be null. This would be problematic as it would lead to not rendering the headers of tables when there was no content (for example in the SystemsMonitor in the Networks tab). Now, regardless of whether there is content or not in the table, the header is visible. --- Userland/Libraries/LibGUI/HeaderView.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGUI/HeaderView.cpp b/Userland/Libraries/LibGUI/HeaderView.cpp index 590035b2f9..7bb91e9e39 100644 --- a/Userland/Libraries/LibGUI/HeaderView.cpp +++ b/Userland/Libraries/LibGUI/HeaderView.cpp @@ -82,7 +82,7 @@ HeaderView::VisibleSectionRange HeaderView::visible_section_range() const auto is_horizontal = m_orientation == Orientation::Horizontal; auto rect = m_table_view.visible_content_rect(); auto start = is_horizontal ? rect.top_left().x() : rect.top_left().y(); - auto end = is_horizontal ? rect.top_right().x() : rect.bottom_left().y(); + auto end = is_horizontal ? (rect.top_left().x() + m_table_view.content_width()) : rect.bottom_left().y(); auto offset = 0; VisibleSectionRange range; for (; range.end < section_count; ++range.end) {