diff --git a/src/DocumentLayout.cpp b/src/DocumentLayout.cpp index e529ace..3f3bb07 100644 --- a/src/DocumentLayout.cpp +++ b/src/DocumentLayout.cpp @@ -21,7 +21,7 @@ void DocumentLayout::run() { largest_height_so_far = child->rect().height(); } - bool new_row_because_of_control_widget = (child->control_type() == ControlWidgetType::NewRow && largest_height_so_far); + bool new_row_because_of_control_widget = (child->control_type() == ControlWidgetType::NewRow); bool new_row_because_of_justification = (current_position.x() + child->rect().width() + m_margin) >= m_target->rect().width(); bool should_do_new_row = new_row_because_of_control_widget || new_row_because_of_justification; if (should_do_new_row) { @@ -31,7 +31,10 @@ void DocumentLayout::run() { child->rect().set_x(current_position.x()); child->rect().set_y(current_position.y()); - current_position.add(child->rect().width() + m_margin, 0); + + if (!new_row_because_of_control_widget) { + current_position.add(child->rect().width() + m_margin, 0); + } } }