I just have tried this (Note that iZoomFactor is an int, which is 100 for a scale of 1, 50 for a scale of .5 etc):
pPicture->scale(.5, .5);
// [EDIT:] Here i get the size of the item in the view coords system, divide it by 2 (For the center) and add it's position.
cCenterOn.setX( (100/pPicture->pixmap().width()*iZoomFactor) / 2 + pPicture->pos().x() );
cCenterOn.setY( (100/pPicture->pixmap().height()*iZoomFactor) / 2 + pPicture->pos().y() );
grphVwOriginalPicture->centerOn(cCenterOn);
pPicture = (QGraphicsPixmapItem*)grphVwOriginalPicture->items().first();
pPicture->scale(.5, .5);
QPoint cCenterOn;
// [EDIT:] Here i get the size of the item in the view coords system, divide it by 2 (For the center) and add it's position.
cCenterOn.setX( (100/pPicture->pixmap().width()*iZoomFactor) / 2 + pPicture->pos().x() );
cCenterOn.setY( (100/pPicture->pixmap().height()*iZoomFactor) / 2 + pPicture->pos().y() );
grphVwOriginalPicture->centerOn(cCenterOn);
To copy to clipboard, switch view to plain text mode
But the same problem is here... I'm not sure of what i can try next, but for now i'm stuck.
[EDIT:]Attached is what i want, it's achieved by scaling the whole scene instead of the item. But i cant keep scaling the whole scene, since i'll have to put another item in it which has to not be scaled.
Pierre.
Bookmarks