From koffice-devel Sun Apr 26 22:27:21 2009 From: Jan Hambrecht Date: Sun, 26 Apr 2009 22:27:21 +0000 To: koffice-devel Subject: koffice/libs/guiutils Message-Id: <1240784841.328652.13751.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=koffice-devel&m=124078485303194 SVN commit 959725 by jaham: fix calculating offset to fit shapes into specified painter rectangle (the painter rectangle does not necessarily start at point 0,0) please review for backporting CCMAIL:koffice-devel@kde.org M +4 -3 KoShapePainter.cpp --- trunk/koffice/libs/guiutils/KoShapePainter.cpp #959724:959725 @@ -162,10 +162,11 @@ painter.setRenderHint(QPainter::Antialiasing); painter.setClipRect( painterRect ); + // convert document rectangle to view coordinates QRectF zoomedBound = zoomHandler.documentToView( documentRect ); - QPointF offset = QPointF( 0.5 * painterRect.width(), 0.5 * painterRect.height() ) - zoomedBound.center(); - - // center content in image + // calculate offset between painter rectangle and converted document rectangle + QPointF offset = QPointF(painterRect.center()) - zoomedBound.center(); + // center content in painter rectangle painter.translate( offset.x(), offset.y() ); // finally paint the shapes _______________________________________________ koffice-devel mailing list koffice-devel@kde.org https://mail.kde.org/mailman/listinfo/koffice-devel