mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
HackStudio: Make locator lose focus on close
Make locator lose focus when pressing escape or by clicking in the editor area.
This commit is contained in:
parent
b43dad1741
commit
3931b292b0
1 changed files with 7 additions and 0 deletions
|
@ -103,9 +103,12 @@ Locator::Locator(Core::Object* parent)
|
|||
m_textbox->on_change = [this] {
|
||||
update_suggestions();
|
||||
};
|
||||
|
||||
m_textbox->on_escape_pressed = [this] {
|
||||
m_popup_window->hide();
|
||||
m_textbox->set_focus(false);
|
||||
};
|
||||
|
||||
m_textbox->on_up_pressed = [this] {
|
||||
GUI::ModelIndex new_index = m_suggestion_view->selection().first();
|
||||
if (new_index.is_valid())
|
||||
|
@ -138,6 +141,10 @@ Locator::Locator(Core::Object* parent)
|
|||
open_suggestion(selected_index);
|
||||
};
|
||||
|
||||
m_textbox->on_focusout = [&]() {
|
||||
close();
|
||||
};
|
||||
|
||||
m_popup_window = GUI::Window::construct(parent);
|
||||
// FIXME: This is obviously not a tooltip window, but it's the closest thing to what we want atm.
|
||||
m_popup_window->set_window_type(GUI::WindowType::Tooltip);
|
||||
|
|
Loading…
Add table
Reference in a new issue