Преглед изворни кода

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.
martinfalisse пре 3 година
родитељ
комит
472a3df03b
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      Userland/Libraries/LibGUI/HeaderView.cpp

+ 1 - 1
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) {