From 6dd0a1338fa2a41fd955153485672abffe1e7c60 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Tue, 26 Jul 2022 01:05:37 +0300 Subject: [PATCH] fix documentlayout automatic sizing --- src/DocumentLayout.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/DocumentLayout.cpp b/src/DocumentLayout.cpp index 8761b4c..ba9b83c 100644 --- a/src/DocumentLayout.cpp +++ b/src/DocumentLayout.cpp @@ -9,7 +9,7 @@ void DocumentLayout::run() { if (!m_target) return; - Point bound { m_margin, m_margin }; + Point bound { m_margin + m_target->rect().max_geometry().width(), m_margin }; Point current_position { m_margin, m_margin }; double largest_height_so_far = -1.0; @@ -36,10 +36,12 @@ void DocumentLayout::run() { if (!new_row_because_of_control_widget) { current_position.add(child->rect().width() + m_margin, 0); - bound.add(child->rect().width() + m_margin, 0); } } + /* account for the first row */ + bound.add(0, largest_height_so_far); + m_target->rect().set_width(bound.x()); m_target->rect().set_height(bound.y()); }