mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:37:35 +00:00
LibGUI: GTableModel::data() should take a GModelIndex instead of int,int.
This commit is contained in:
parent
dc4e6dd7bc
commit
7df1121e1c
6 changed files with 12 additions and 12 deletions
|
@ -45,11 +45,11 @@ public:
|
|||
virtual String row_name(int) const { return { }; }
|
||||
virtual String column_name(int) const { return { }; }
|
||||
virtual ColumnMetadata column_metadata(int) const { return { }; }
|
||||
virtual GVariant data(int row, int column) const = 0;
|
||||
virtual GVariant data(const GModelIndex&) const = 0;
|
||||
virtual void update() = 0;
|
||||
virtual void activate(const GModelIndex&) { }
|
||||
|
||||
bool is_valid(GModelIndex index) const
|
||||
bool is_valid(const GModelIndex& index) const
|
||||
{
|
||||
return index.row() >= 0 && index.row() < row_count() && index.column() >= 0 && index.column() < column_count();
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ void GTableView::paint_event(GPaintEvent& event)
|
|||
auto column_metadata = m_model->column_metadata(column_index);
|
||||
int column_width = column_metadata.preferred_width;
|
||||
Rect cell_rect(horizontal_padding() + x_offset, y, column_width, item_height());
|
||||
auto data = m_model->data(row_index, column_index);
|
||||
auto data = m_model->data({ row_index, column_index });
|
||||
if (data.is_bitmap())
|
||||
painter.blit(cell_rect.location(), data.as_bitmap(), data.as_bitmap().rect());
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue