[Qt-interest] QPainter clipping and transformations
Schimkowitsch Robert
Robert.Schimkowitsch at andritz.com
Fri Sep 16 17:27:16 CEST 2011
Does or doesn't the current transformation set on a painter affect it's
clipRect behavour?
Help says:
"Note that the clip rectangle is specified in logical (painter)
coordinates."
My documentation from the GraphicsView InDepth training says:
"Without transformations, 1 logical coordinate = 1 pixel"
which implies that logical coordinates are subject to transformations.
Conclusion: Clipping should be subject to the currently set
transformation.
BUT....
Reality says otherwise.
By trial-and-error I found that the order of calls affects the behaviour
of clipping:
If I call setClipRect after setTransform, I can use the transformed
coordinate system.
Otherwise, setClipRect still needs the "old" coordinate system valid
before setTransform.
You could argue that it's logical that setTransform would affect the
currently set clipRect and clipRegion, but at least it's not an obvious
behaviour. And there's no hint in the help to indicate this.
In addition, I found out that manually calculating my mapped clip rect
using the inverted transformation results in inprecise results. And if
that this is how setTransform corrects the clip rect, this can result in
bad clipping.
Seems to me, it's better to set the transformation first, then the exact
clipping rectangle.
Kind regards
Robert Schimkowitsch
#####################################################################################
This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system.
Thank You.
ANDRITZ HYDRO GmbH
Rechtsform/ Legal form: Gesellschaft mit beschrankter Haftung / Corporation
Firmensitz/ Registered seat: Wien
Firmenbuchgericht/ Court of registry: Handelsgericht Wien
Firmenbuchnummer/ Company registration: FN 61833 g
DVR: 0605077
UID-Nr.: ATU14756806
#####################################################################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110916/349b60c0/attachment.html
More information about the Qt-interest-old
mailing list