! * called if the worksheet page (the actual size of worksheet's rectangular) was changed. * if a layout is active, it is is updated - this adjusts the sizes of the elements in the layout to the new page size. * if no layout is active and the option "scale content" is active, \c handleResize() is called to adjust the properties. */
| 1585 | * if no layout is active and the option "scale content" is active, \c handleResize() is called to adjust the properties. |
| 1586 | */ |
| 1587 | void WorksheetPrivate::updatePageRect() { |
| 1588 | if (q->isLoading()) |
| 1589 | return; |
| 1590 | |
| 1591 | QRectF oldRect = m_scene->sceneRect(); |
| 1592 | m_scene->setSceneRect(pageRect); |
| 1593 | |
| 1594 | if (layout != Worksheet::Layout::NoLayout) |
| 1595 | updateLayout(); |
| 1596 | else { |
| 1597 | if (scaleContent) { |
| 1598 | qreal horizontalRatio = pageRect.width() / oldRect.width(); |
| 1599 | qreal verticalRatio = pageRect.height() / oldRect.height(); |
| 1600 | const auto& children = q->children<WorksheetElement>(AbstractAspect::ChildIndexFlag::IncludeHidden); |
| 1601 | if (useViewSize) { |
| 1602 | // don't make the change of the geometry undoable/redoable if the view size is used. |
| 1603 | for (auto* elem : children) { |
| 1604 | elem->setUndoAware(false); |
| 1605 | elem->handleResize(horizontalRatio, verticalRatio, true); |
| 1606 | elem->setUndoAware(true); |
| 1607 | } |
| 1608 | } else { |
| 1609 | // for (auto* child : children) |
| 1610 | // child->handleResize(horizontalRatio, verticalRatio, true); |
| 1611 | } |
| 1612 | } |
| 1613 | } |
| 1614 | } |
| 1615 | |
| 1616 | void WorksheetPrivate::update() { |
| 1617 | q->update(); |
no test coverage detected