! This method sets the position type of the X coordinate to \a type. For a detailed description of what a position type is, see the documentation of \ref setType. \see setType, setTypeY */
| 11574 | \see setType, setTypeY |
| 11575 | */ |
| 11576 | void QCPItemPosition::setTypeX(QCPItemPosition::PositionType type) |
| 11577 | { |
| 11578 | if (mPositionTypeX != type) |
| 11579 | { |
| 11580 | // if switching from or to coordinate type that isn't valid (e.g. because axes or axis rect |
| 11581 | // were deleted), don't try to recover the pixelPosition() because it would output a qDebug warning. |
| 11582 | bool retainPixelPosition = true; |
| 11583 | if ((mPositionTypeX == ptPlotCoords || type == ptPlotCoords) && (!mKeyAxis || !mValueAxis)) |
| 11584 | retainPixelPosition = false; |
| 11585 | if ((mPositionTypeX == ptAxisRectRatio || type == ptAxisRectRatio) && (!mAxisRect)) |
| 11586 | retainPixelPosition = false; |
| 11587 | |
| 11588 | QPointF pixel; |
| 11589 | if (retainPixelPosition) |
| 11590 | pixel = pixelPosition(); |
| 11591 | |
| 11592 | mPositionTypeX = type; |
| 11593 | |
| 11594 | if (retainPixelPosition) |
| 11595 | setPixelPosition(pixel); |
| 11596 | } |
| 11597 | } |
| 11598 | |
| 11599 | /*! |
| 11600 | This method sets the position type of the Y coordinate to \a type. |
nothing calls this directly
no outgoing calls
no test coverage detected