[Qt-interest] Using OpenGL to render and transform a SVG in a QDialog
Andre Somers
andre at familiesomers.nl
Tue Oct 19 08:16:05 CEST 2010
Op 18-10-2010 22:08, Sven Grunewaldt schreef:
> Thanks for your reply Max,
>
> rotating before rendering did indeed work:
(...)
> The image does rotate now but it keeps the top left corner of the SVG in
> the top left corner of the QGLWidget:
> http://dl.dropbox.com/u/256059/tmp/qglwidget.png
>
> I guess it is my responsibility to recalculate the position and "center"
> the SVG again... I can't see how I'm supposed to do that with QTransform
> or QPainter other than moving the ViewPort - is this correct?
Yes. And it is not that hard. The easiest way is to do it in a few
steps: first, create a transformation that represents the translation.
You just make sure that you translate the centre of your needle to the
origin of your painter. Create the inverted transformation too, so you
can translate back. Then, create your total matrix by multiplying the
transformation matrices: TM = translate center to origin * rotation *
translate back. This matrix should do what you want.
André
More information about the Qt-interest-old
mailing list