mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:48:12 +00:00
LibGUI: Make inline editing work in ColumnsView
All it took was overriding content_rect() :^)
This commit is contained in:
parent
f52527ef9c
commit
5a0b1c46aa
2 changed files with 18 additions and 2 deletions
|
@ -305,8 +305,8 @@ void ColumnsView::move_cursor(CursorMovement movement, SelectionUpdate selection
|
|||
if (model.is_valid(cursor_index()))
|
||||
push_column(cursor_index());
|
||||
update();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -328,4 +328,19 @@ void ColumnsView::keydown_event(KeyEvent& event)
|
|||
AbstractView::keydown_event(event);
|
||||
}
|
||||
|
||||
Gfx::IntRect ColumnsView::content_rect(const ModelIndex& index) const
|
||||
{
|
||||
if (!index.is_valid())
|
||||
return {};
|
||||
|
||||
int column_x = 0;
|
||||
for (auto& column : m_columns) {
|
||||
if (column.parent_index == index.parent())
|
||||
return { column_x, index.row() * item_height(), column.width, item_height() };
|
||||
column_x += column.width;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue