MCPcopy Create free account
hub / github.com/KDE/labplot / updatePageRect

Method updatePageRect

src/backend/worksheet/Worksheet.cpp:1587–1614  ·  view source on GitHub ↗

! * 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. */

Source from the content-addressed store, hash-verified

1585 * if no layout is active and the option "scale content" is active, \c handleResize() is called to adjust the properties.
1586 */
1587void 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
1616void WorksheetPrivate::update() {
1617 q->update();

Callers 2

finalizeMethod · 0.80
setPageRectMethod · 0.80

Calls 5

isLoadingMethod · 0.80
heightMethod · 0.80
setUndoAwareMethod · 0.80
widthMethod · 0.45
handleResizeMethod · 0.45

Tested by

no test coverage detected