diff options
author | thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> | 2022-08-30 07:38:20 -0400 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-08-30 16:28:44 +0100 |
commit | cce9172cd42aa581206329d2a6aa825322f50bbe (patch) | |
tree | 65bbaf667625ec1442f01d36d23a100c2ded9026 /Userland/Applications/PDFViewer/PDFViewerWidget.cpp | |
parent | 6cedb1b9d9794addae1879f5c8c39319fa6a2a10 (diff) | |
download | serenity-cce9172cd42aa581206329d2a6aa825322f50bbe.zip |
Applications+DevTools: Remove fixed sizes from Splitters
And adjust some GML properties. Since a808cfa, splitters grow
opportunistically. Setting them to fixed sizes now quite literally
fixes them in place. Fixes immovable splitters missed in the
aforementioned commit.
Diffstat (limited to 'Userland/Applications/PDFViewer/PDFViewerWidget.cpp')
-rw-r--r-- | Userland/Applications/PDFViewer/PDFViewerWidget.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp index 0f388d922d..73600f3867 100644 --- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp +++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp @@ -28,9 +28,11 @@ PDFViewerWidget::PDFViewerWidget() auto& toolbar = toolbar_container.add<GUI::Toolbar>(); auto& splitter = add<GUI::HorizontalSplitter>(); + splitter.layout()->set_spacing(4); m_sidebar = splitter.add<SidebarWidget>(); - m_sidebar->set_fixed_width(0); + m_sidebar->set_preferred_width(200); + m_sidebar->set_visible(false); m_viewer = splitter.add<PDFViewer>(); m_viewer->on_page_change = [&](auto new_page) { @@ -73,7 +75,7 @@ void PDFViewerWidget::initialize_toolbar(GUI::Toolbar& toolbar) auto open_outline_action = GUI::Action::create( "Toggle &Sidebar", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/sidebar.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { m_sidebar_open = !m_sidebar_open; - m_sidebar->set_fixed_width(m_sidebar_open ? 200 : 0); + m_sidebar->set_visible(m_sidebar_open ? true : false); }, nullptr); open_outline_action->set_enabled(false); @@ -214,11 +216,11 @@ void PDFViewerWidget::open_file(Core::File& file) if (document->outline()) { auto outline = document->outline(); m_sidebar->set_outline(outline.release_nonnull()); - m_sidebar->set_fixed_width(200); + m_sidebar->set_visible(true); m_sidebar_open = true; } else { m_sidebar->set_outline({}); - m_sidebar->set_fixed_width(0); + m_sidebar->set_visible(false); m_sidebar_open = false; } } |