Browse Source

LibGUI: Add corresponding padding to ListView content width

Fixes clipped text in list items
thankyouverycool 4 năm trước cách đây
mục cha
commit
b02be11a6f
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      Userland/Libraries/LibGUI/ListView.cpp

+ 1 - 1
Userland/Libraries/LibGUI/ListView.cpp

@@ -62,7 +62,7 @@ void ListView::update_content_size()
     int content_width = 0;
     for (int row = 0, row_count = model()->row_count(); row < row_count; ++row) {
         auto text = model()->index(row, m_model_column).data();
-        content_width = max(content_width, font().width(text.to_string()));
+        content_width = max(content_width, font().width(text.to_string()) + horizontal_padding() + 1);
     }
 
     content_width = max(content_width, widget_inner_rect().width());