| 4217 | } |
| 4218 | |
| 4219 | void CartesianPlotPrivate::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) { |
| 4220 | if (mouseMode == CartesianPlot::MouseMode::Selection) { |
| 4221 | setCursor(Qt::ArrowCursor); |
| 4222 | panningStarted = false; |
| 4223 | |
| 4224 | // TODO: why do we do this all the time?!?! |
| 4225 | const QPointF& itemPos = pos(); // item's center point in parent's coordinates; |
| 4226 | const qreal x = itemPos.x(); |
| 4227 | const qreal y = itemPos.y(); |
| 4228 | |
| 4229 | // calculate the new rect and set it |
| 4230 | QRectF newRect; |
| 4231 | const qreal w = rect.width(); |
| 4232 | const qreal h = rect.height(); |
| 4233 | newRect.setX(x - w / 2); |
| 4234 | newRect.setY(y - h / 2); |
| 4235 | newRect.setWidth(w); |
| 4236 | newRect.setHeight(h); |
| 4237 | |
| 4238 | // TODO: autoscale |
| 4239 | |
| 4240 | suppressRetransform = true; |
| 4241 | q->setRect(newRect); |
| 4242 | suppressRetransform = false; |
| 4243 | |
| 4244 | QGraphicsItem::mouseReleaseEvent(event); |
| 4245 | Q_EMIT q->changed(); // notify about the position change |
| 4246 | } else if (mouseMode == CartesianPlot::MouseMode::ZoomSelection || mouseMode == CartesianPlot::MouseMode::ZoomXSelection |
| 4247 | || mouseMode == CartesianPlot::MouseMode::ZoomYSelection) { |
| 4248 | Q_EMIT q->mouseReleaseZoomSelectionModeSignal(); |
| 4249 | } |
| 4250 | } |
| 4251 | |
| 4252 | void CartesianPlotPrivate::mouseReleaseZoomSelectionMode(int cSystemIndex, bool suppressRetransform) { |
| 4253 | m_selectionBandIsShown = false; |