diff options
-rw-r--r-- | Userland/Libraries/LibGUI/ComboBox.cpp | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/ListView.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/ListView.h | 3 |
3 files changed, 1 insertions, 15 deletions
diff --git a/Userland/Libraries/LibGUI/ComboBox.cpp b/Userland/Libraries/LibGUI/ComboBox.cpp index fe38afff80..747625ee38 100644 --- a/Userland/Libraries/LibGUI/ComboBox.cpp +++ b/Userland/Libraries/LibGUI/ComboBox.cpp @@ -257,6 +257,7 @@ void ComboBox::open() } rect.intersect(desktop); m_list_window->set_rect(rect); + m_list_view->set_min_size(rect.size()); if (m_selected_index.has_value()) m_list_view->set_cursor(m_selected_index.value(), AbstractView::SelectionUpdate::Set); diff --git a/Userland/Libraries/LibGUI/ListView.cpp b/Userland/Libraries/LibGUI/ListView.cpp index 1cc110de0e..f89509043e 100644 --- a/Userland/Libraries/LibGUI/ListView.cpp +++ b/Userland/Libraries/LibGUI/ListView.cpp @@ -44,7 +44,6 @@ void ListView::update_content_size() auto text = model()->index(row, m_model_column).data(); content_width = max(content_width, font().width(text.to_deprecated_string()) + horizontal_padding() * 2); } - m_max_item_width = content_width; content_width = max(content_width, widget_inner_rect().width()); int content_height = item_count() * item_height(); @@ -268,15 +267,4 @@ void ListView::scroll_into_view(ModelIndex const& index, bool scroll_horizontall AbstractScrollableWidget::scroll_into_view(content_rect(index.row()), scroll_horizontally, scroll_vertically); } -Optional<UISize> ListView::calculated_min_size() const -{ - auto min_width = horizontal_scrollbar().effective_min_size().width().as_int() + vertical_scrollbar().width() + frame_thickness() * 2; - auto min_height = vertical_scrollbar().effective_min_size().height().as_int() + horizontal_scrollbar().height() + frame_thickness() * 2; - auto content_exceeds_minimums = content_width() > min_width && content_height() > min_height; - auto scrollbars_are_visible = horizontal_scrollbar().is_visible() && vertical_scrollbar().is_visible(); - if (content_exceeds_minimums || scrollbars_are_visible) - return AbstractScrollableWidget::calculated_min_size(); - return { { m_max_item_width + frame_thickness() * 2, content_height() + frame_thickness() * 2 } }; -} - } diff --git a/Userland/Libraries/LibGUI/ListView.h b/Userland/Libraries/LibGUI/ListView.h index 9b16e556cc..6cc9bc2b8b 100644 --- a/Userland/Libraries/LibGUI/ListView.h +++ b/Userland/Libraries/LibGUI/ListView.h @@ -56,15 +56,12 @@ private: virtual void mousemove_event(MouseEvent&) override; virtual void layout_relevant_change_occurred() override; - virtual Optional<UISize> calculated_min_size() const override; - Gfx::IntRect content_rect(int row) const; void update_content_size(); int m_horizontal_padding { 2 }; int m_vertical_padding { 2 }; int m_model_column { 0 }; - int m_max_item_width { 0 }; bool m_alternating_row_colors { true }; bool m_hover_highlighting { false }; }; |