Greetings,
To further explain what is the problem:
1. Creation of item
QGraphicsPixmap *pix=new QGraphicsPixmap();
pix->setPixmap(somePixmap);
scene->addItem(pix);
QGraphicsPixmap *pix=new QGraphicsPixmap();
pix->setPixmap(somePixmap);
scene->addItem(pix);
To copy to clipboard, switch view to plain text mode
2. Mouse wheel event on scene
resetTransform();
setTransform(QTransform::fromTranslate(-brc.width()/2.0, -brc.height()/2.0)*QTransform::fromScale(sx, sy).rotate(alpha)*QTransform::fromTranslate(brc.width()/2.0, brc.height()/2.0), true);
resetTransform();
QRectF brc=boundingRect();
setTransform(QTransform::fromTranslate(-brc.width()/2.0, -brc.height()/2.0)*QTransform::fromScale(sx, sy).rotate(alpha)*QTransform::fromTranslate(brc.width()/2.0, brc.height()/2.0), true);
To copy to clipboard, switch view to plain text mode
3. Do something with scene position of item
QList<QGraphicsItem*> sel=selectedItems();
int i;
for(i=0;i<sel.count();i++)
{
sel[i]->setPos(xy.x(),xy.y()-tranStep); //here the position should only change for tranStep but it does not (the change is much larger and rotation also affects change in position)
}
QList<QGraphicsItem*> sel=selectedItems();
int i;
for(i=0;i<sel.count();i++)
{
QPointF xy=sel[i]->scenePos();
sel[i]->setPos(xy.x(),xy.y()-tranStep); //here the position should only change for tranStep but it does not (the change is much larger and rotation also affects change in position)
}
To copy to clipboard, switch view to plain text mode
I hope this further explains what am I trying to achieve and where is the problem.
Thank you.
Regards,
MadBear
Bookmarks