From ff98f55b8531bc9b9ebcc885b0446a672cc016b7 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 21 May 2020 20:54:21 +0200 Subject: LibGUI: Fix view column auto-sizing of icon-only columns For icon columns, just use the item height as the auto width for now. This gives us 16x16 icons, which is always what we want anyway. --- Libraries/LibGUI/AbstractTableView.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Libraries/LibGUI/AbstractTableView.cpp') diff --git a/Libraries/LibGUI/AbstractTableView.cpp b/Libraries/LibGUI/AbstractTableView.cpp index 9e8694b0ad..d67d489efb 100644 --- a/Libraries/LibGUI/AbstractTableView.cpp +++ b/Libraries/LibGUI/AbstractTableView.cpp @@ -71,15 +71,17 @@ void AbstractTableView::update_column_sizes() if (is_column_hidden(column)) continue; int header_width = header_font().width(model.column_name(column)); - if (column == key_column) + if (column == key_column && model.is_column_sortable(column)) header_width += font().width(" \xE2\xAC\x86"); // UPWARDS BLACK ARROW int column_width = header_width; for (int row = 0; row < row_count; ++row) { auto cell_data = model.data(model.index(row, column)); int cell_width = 0; - if (cell_data.is_bitmap()) { + if (cell_data.is_icon()) { + cell_width = item_height(); + } else if (cell_data.is_bitmap()) { cell_width = cell_data.as_bitmap().width(); - } else { + } else if (cell_data.is_valid()) { cell_width = font().width(cell_data.to_string()); } column_width = max(column_width, cell_width); -- cgit v1.2.3