! Updates the layout element and sub-elements. This function is automatically called before every replot by the parent layout element. It is called multiple times, once for every \ref UpdatePhase. The phases are run through in the order of the enum values. For details about what happens at the different phases, see the documentation of \ref UpdatePhase. Layout elements that have child
| 3434 | Subclasses should make sure to call the base class implementation. |
| 3435 | */ |
| 3436 | void QCPLayoutElement::update(UpdatePhase phase) |
| 3437 | { |
| 3438 | if (phase == upMargins) |
| 3439 | { |
| 3440 | if (mAutoMargins != QCP::msNone) |
| 3441 | { |
| 3442 | // set the margins of this layout element according to automatic margin calculation, either directly or via a margin group: |
| 3443 | QMargins newMargins = mMargins; |
| 3444 | const QList<QCP::MarginSide> allMarginSides = QList<QCP::MarginSide>() << QCP::msLeft << QCP::msRight << QCP::msTop << QCP::msBottom; |
| 3445 | foreach (QCP::MarginSide side, allMarginSides) |
| 3446 | { |
| 3447 | if (mAutoMargins.testFlag(side)) // this side's margin shall be calculated automatically |
| 3448 | { |
| 3449 | if (mMarginGroups.contains(side)) |
| 3450 | QCP::setMarginValue(newMargins, side, mMarginGroups[side]->commonMargin(side)); // this side is part of a margin group, so get the margin value from that group |
| 3451 | else |
| 3452 | QCP::setMarginValue(newMargins, side, calculateAutoMargin(side)); // this side is not part of a group, so calculate the value directly |
| 3453 | // apply minimum margin restrictions: |
| 3454 | if (QCP::getMarginValue(newMargins, side) < QCP::getMarginValue(mMinimumMargins, side)) |
| 3455 | QCP::setMarginValue(newMargins, side, QCP::getMarginValue(mMinimumMargins, side)); |
| 3456 | } |
| 3457 | } |
| 3458 | setMargins(newMargins); |
| 3459 | } |
| 3460 | } |
| 3461 | } |
| 3462 | |
| 3463 | /*! |
| 3464 | Returns the suggested minimum size this layout element (the \ref outerRect) may be compressed to, |
no test coverage detected