mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 17:35:06 +00:00
LibGUI: Update GTableView's scrollbar range in response to resize.
This commit is contained in:
parent
82c22a7484
commit
827ec99a8f
2 changed files with 9 additions and 2 deletions
|
@ -32,12 +32,18 @@ void GTableView::set_model(OwnPtr<GTableModel>&& model)
|
|||
void GTableView::resize_event(GResizeEvent& event)
|
||||
{
|
||||
m_scrollbar->set_relative_rect(event.size().width() - m_scrollbar->preferred_size().width(), 0, m_scrollbar->preferred_size().width(), event.size().height());
|
||||
update_scrollbar_range();
|
||||
}
|
||||
|
||||
void GTableView::update_scrollbar_range()
|
||||
{
|
||||
int excess_height = max(0, (item_count() * item_height()) - height());
|
||||
m_scrollbar->set_range(0, excess_height);
|
||||
}
|
||||
|
||||
void GTableView::did_update_model()
|
||||
{
|
||||
int excess_height = max(0, (item_count() * item_height()) - height());
|
||||
m_scrollbar->set_range(0, excess_height);
|
||||
update_scrollbar_range();
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue