1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:38:10 +00:00

LibGUI+Applications: Rename Model::is_valid to is_within_range

The previous name did not describe what the function checked, and was
easy to confuse with ModelIndex::is_valid.
This commit is contained in:
sin-ack 2021-06-27 12:08:16 +00:00 committed by Andreas Kling
parent 9899addb1d
commit 16ac3bbfd7
8 changed files with 18 additions and 18 deletions

View file

@ -220,7 +220,7 @@ void TableView::move_cursor(CursorMovement movement, SelectionUpdate selection_u
int items_per_page = visible_content_rect().height() / row_height();
auto old_index = selection().first();
auto new_index = model.index(max(0, old_index.row() - items_per_page), old_index.column());
if (model.is_valid(new_index))
if (model.is_within_range(new_index))
set_cursor(new_index, selection_update);
break;
}
@ -228,7 +228,7 @@ void TableView::move_cursor(CursorMovement movement, SelectionUpdate selection_u
int items_per_page = visible_content_rect().height() / row_height();
auto old_index = selection().first();
auto new_index = model.index(min(model.row_count() - 1, old_index.row() + items_per_page), old_index.column());
if (model.is_valid(new_index))
if (model.is_within_range(new_index))
set_cursor(new_index, selection_update);
break;
}