diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-21 20:54:21 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-21 20:54:21 +0200 |
commit | ff98f55b8531bc9b9ebcc885b0446a672cc016b7 (patch) | |
tree | 9b342aa26b1b2119cd25211fcfbb087676b8eb12 /Libraries/LibGUI/AbstractTableView.cpp | |
parent | 248f2d5cf549c30ae40a6e5f44218fa40cca5947 (diff) | |
download | serenity-ff98f55b8531bc9b9ebcc885b0446a672cc016b7.zip |
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.
Diffstat (limited to 'Libraries/LibGUI/AbstractTableView.cpp')
-rw-r--r-- | Libraries/LibGUI/AbstractTableView.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
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); |