1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 02:45:08 +00:00

LibGUI: Add a mode where GTableModel automatically activates on selection.

This commit is contained in:
Andreas Kling 2019-03-15 16:25:30 +01:00
parent 84f5312dc2
commit c1f2f5a153
4 changed files with 20 additions and 1 deletions

View file

@ -33,3 +33,14 @@ void GTableModel::did_update()
view.did_update_model();
});
}
void GTableModel::set_selected_index(const GModelIndex& index)
{
if (m_selected_index == index)
return;
m_selected_index = index;
if (on_selection_changed)
on_selection_changed(index);
if (m_activates_on_selection && is_valid(index))
activate(index);
}