void Cropper::wheelEvent(QGraphicsSceneWheelEvent *event){ event->setAccepted( true ); //qDebug()<<"X: "<<tl.x()<<" Y: "<<tl.y()<<" botX: "<<br.x()<<" botY: "<<br.y(); int numDegrees = event->delta() / 8; int numSteps = numDegrees / 15; _rotat += numSteps; if(_rotat>90) _rotat=90; else if(_rotat<-90) _rotat=-90; QTransform trans = QTransform().rotate(-_rotat ); qreal w = MVNDW->photoImg.width(); qreal h = MVNDW->photoImg.height(); QPointF p[4]; p[0] = QPoint(0, 0); p[1] = QPointF(w, 0); p[2] = QPointF(w, h); p[3] = QPointF(0, h); QPointF offs(0, 0); for (int i = 0; i < 4; ++i) { QPointF temp = trans.map(p[i]); offs.setX(qMin(offs.x(), temp.x())); offs.setY(qMin(offs.y(), temp.y())); } QPointF LT = mapMapToPar[img][/img]ent(boundingRect().topLeft()) - offs; int x = int(LT.x()); int y = int(LT.y() ); QImage rotated = MVNDW->photoImg.transformed(trans).copy(x, y, boundingRect().width(), boundingRect().height()); MVNDW->PreviewImage->setPixmap(QPixmap::fromImage(rotated)); setRotation(_rotat);}
QPointF LT = mapMapToPar[img][/img]ent(boundingRect().topLeft()) - offs;
C++ (Qt)QPointF LT = trans.map(mapToScene(QPointF(_drawingOrigenX, _drawingOrigenY))) - offs;