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

Method mouseReleaseEvent

src/backend/worksheet/plots/cartesian/CartesianPlot.cpp:4219–4250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4217}
4218
4219void 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
4252void CartesianPlotPrivate::mouseReleaseZoomSelectionMode(int cSystemIndex, bool suppressRetransform) {
4253 m_selectionBandIsShown = false;

Callers

nothing calls this directly

Calls 9

xMethod · 0.80
heightMethod · 0.80
setXMethod · 0.80
setYMethod · 0.80
setHeightMethod · 0.80
yMethod · 0.45
widthMethod · 0.45
setWidthMethod · 0.45
setRectMethod · 0.45

Tested by

no test coverage detected