1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:37:35 +00:00

HackStudio: File search box stays opened after closing

Fix ##5061 by passing the parent widget down to the locator object
and having the locator object parent it's window to it.
This commit is contained in:
Tim Waterhouse 2021-04-03 20:37:09 -07:00 committed by Andreas Kling
parent 8e4e640717
commit 7648f6aa7b
2 changed files with 11 additions and 8 deletions

View file

@ -128,7 +128,7 @@ LocatorSuggestionModel::Suggestion LocatorSuggestionModel::Suggestion::create_sy
return s;
}
Locator::Locator()
Locator::Locator(Core::Object* parent)
{
set_layout<GUI::VerticalBoxLayout>();
set_fixed_height(20);
@ -171,7 +171,7 @@ Locator::Locator()
open_suggestion(selected_index);
};
m_popup_window = GUI::Window::construct();
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);
m_popup_window->set_rect(0, 0, 500, 200);
@ -234,11 +234,14 @@ void Locator::update_suggestions()
}
dbgln("I have {} suggestion(s):", suggestions.size());
for (auto& s : suggestions) {
if (s.is_filename())
dbgln(" {}", s.as_filename.value());
if (s.is_symbol_declaration())
dbgln(" {} ({})", s.as_symbol_declaration.value().name, s.as_symbol_declaration.value().position.file);
// Limit the debug logging otherwise this can be very slow for large projects
if (suggestions.size() < 100) {
for (auto& s : suggestions) {
if (s.is_filename())
dbgln(" {}", s.as_filename.value());
if (s.is_symbol_declaration())
dbgln(" {} ({})", s.as_symbol_declaration.value().name, s.as_symbol_declaration.value().position.file);
}
}
bool has_suggestions = !suggestions.is_empty();