CharacterMap: Go to character on arrow press in Search window

This commit is contained in:
Karol Kosek 2022-02-26 13:46:58 +01:00 committed by Tim Flynn
parent d4097f104e
commit 17f9d3d45e
Notes: sideshowbarker 2024-07-17 17:57:52 +09:00

View file

@ -68,8 +68,9 @@ CharacterSearchWidget::CharacterSearchWidget()
m_results_table->horizontal_scrollbar().set_visible(false);
m_results_table->set_column_headers_visible(false);
m_results_table->set_model(adopt_ref(*new CharacterSearchModel()));
m_results_table->on_activation = [&](GUI::ModelIndex const& index) {
m_results_table->on_selection_change = [&] {
auto& model = static_cast<CharacterSearchModel&>(*m_results_table->model());
auto index = m_results_table->selection().first();
auto code_point = model.data(index, GUI::ModelRole::Custom).as_u32();
if (on_character_selected)
on_character_selected(code_point);