mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 20:25:07 +00:00
LibGUI: Models should always specify font via Model::Role::Font
This gets rid of one field in ColumnData. The goal is to get rid of all fields and lose ColumnData entirely.
This commit is contained in:
parent
57d15acd4c
commit
04187576ff
8 changed files with 23 additions and 26 deletions
|
@ -105,7 +105,6 @@ void TableView::paint_event(PaintEvent& event)
|
|||
continue;
|
||||
auto column_metadata = model()->column_metadata(column_index);
|
||||
int column_width = this->column_width(column_index);
|
||||
const Gfx::Font& font = column_metadata.font ? *column_metadata.font : this->font();
|
||||
bool is_key_column = model()->key_column() == column_index;
|
||||
Gfx::Rect cell_rect(horizontal_padding() + x_offset, y, column_width, item_height());
|
||||
auto cell_rect_for_fill = cell_rect.inflated(horizontal_padding() * 2, 0);
|
||||
|
@ -137,7 +136,7 @@ void TableView::paint_event(PaintEvent& event)
|
|||
if (cell_background_color.is_valid())
|
||||
painter.fill_rect(cell_rect_for_fill, cell_background_color.to_color(background_color));
|
||||
}
|
||||
painter.draw_text(cell_rect, data.to_string(), font, column_metadata.text_alignment, text_color, Gfx::TextElision::Right);
|
||||
painter.draw_text(cell_rect, data.to_string(), font_for_index(cell_index), column_metadata.text_alignment, text_color, Gfx::TextElision::Right);
|
||||
}
|
||||
}
|
||||
x_offset += column_width + horizontal_padding() * 2;
|
||||
|
@ -197,5 +196,4 @@ void TableView::keydown_event(KeyEvent& event)
|
|||
return Widget::keydown_event(event);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue