diff options
author | thislooksfun <tlf@thislooks.fun> | 2021-10-27 18:49:49 -0500 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-02 17:53:22 +0100 |
commit | e1e856132c5152075dcb074f45bad765c4b73659 (patch) | |
tree | 82b93c777b1dbdb6908ba381f7170aa35ae176cb /Userland/Libraries/LibGUI | |
parent | e4037968423d4d68d099c3ece324fa32ba1122f9 (diff) | |
download | serenity-e1e856132c5152075dcb074f45bad765c4b73659.zip |
LibGUI: Don't suggest widgets inside layouts
Having a widget inside a layout is meaningless, so why suggest them in
the first place?
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r-- | Userland/Libraries/LibGUI/GMLAutocompleteProvider.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGUI/GMLAutocompleteProvider.cpp b/Userland/Libraries/LibGUI/GMLAutocompleteProvider.cpp index 30793d8a3c..5199fdf906 100644 --- a/Userland/Libraries/LibGUI/GMLAutocompleteProvider.cpp +++ b/Userland/Libraries/LibGUI/GMLAutocompleteProvider.cpp @@ -202,9 +202,16 @@ void GMLAutocompleteProvider::provide_completions(Function<void(Vector<Entry>)> break; } } - if (!class_names.is_empty()) + if (!class_names.is_empty()) { register_class_properties_matching_pattern("*", 0u); + auto parent_registration = Core::ObjectClassRegistration::find(class_names.last()); + if (parent_registration && parent_registration->is_derived_from(layout_class)) { + // Layouts can't have child classes, so why suggest them? + break; + } + } + Core::ObjectClassRegistration::for_each([&](const Core::ObjectClassRegistration& registration) { if (!registration.is_derived_from(widget_class)) return; |