diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-03-30 20:42:41 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-03-30 20:42:41 +0100 |
commit | 6d9fa1026b7397780ff598ef1d9e2171ab475919 (patch) | |
tree | 3275618431b10d42bc77efb84376ad085996df79 /LibGUI/GScrollableWidget.cpp | |
parent | eec0a644440d3ef0bf25ef9ca66342b694427bd9 (diff) | |
download | serenity-6d9fa1026b7397780ff598ef1d9e2171ab475919.zip |
LibGUI: Fix bad initial layout of GScrollableWidget's scrollbars.
If it's the first time we're laying these out, we can't rely on the width()
or height() to be set, so instead use preferred_size().
Diffstat (limited to 'LibGUI/GScrollableWidget.cpp')
-rw-r--r-- | LibGUI/GScrollableWidget.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/LibGUI/GScrollableWidget.cpp b/LibGUI/GScrollableWidget.cpp index b6bf79e2ce..01d84e7c66 100644 --- a/LibGUI/GScrollableWidget.cpp +++ b/LibGUI/GScrollableWidget.cpp @@ -30,8 +30,8 @@ void GScrollableWidget::resize_event(GResizeEvent& event) auto inner_rect = frame_inner_rect_for_size(event.size()); update_scrollbar_ranges(); - int height_wanted_by_horizontal_scrollbar = m_horizontal_scrollbar->is_visible() ? m_horizontal_scrollbar->height() : 0; - int width_wanted_by_vertical_scrollbar = m_vertical_scrollbar->is_visible() ? m_vertical_scrollbar->width() : 0; + int height_wanted_by_horizontal_scrollbar = m_horizontal_scrollbar->is_visible() ? m_horizontal_scrollbar->preferred_size().height() : 0; + int width_wanted_by_vertical_scrollbar = m_vertical_scrollbar->is_visible() ? m_vertical_scrollbar->preferred_size().width() : 0; m_vertical_scrollbar->set_relative_rect(inner_rect.right() + 1 - m_vertical_scrollbar->preferred_size().width(), inner_rect.top(), m_vertical_scrollbar->preferred_size().width(), inner_rect.height() - height_wanted_by_horizontal_scrollbar); m_horizontal_scrollbar->set_relative_rect(inner_rect.left(), inner_rect.bottom() + 1 - m_horizontal_scrollbar->preferred_size().height(), inner_rect.width() - m_vertical_scrollbar->preferred_size().width(), width_wanted_by_vertical_scrollbar); |