LibGUI: Set IconView content width to actual content only

Fixes incorrect excess size reporting when updating scrollbars
and allows horizontal scrolling if IconView is resized smaller
than a single column
This commit is contained in:
thankyouverycool 2021-02-17 12:01:22 -05:00 committed by Andreas Kling
parent 08476e7fe7
commit 8789a91a4e
Notes: sideshowbarker 2024-07-18 22:05:28 +09:00

View file

@ -163,7 +163,7 @@ void IconView::update_content_size()
m_visual_row_count = ceil_div(model()->row_count(), m_visual_column_count);
else
m_visual_row_count = 0;
content_width = available_size().width();
content_width = m_visual_column_count * effective_item_size().width();
content_height = m_visual_row_count * effective_item_size().height();
} else {
m_visual_row_count = max(1, available_size().height() / effective_item_size().height());