Thanks for making it clear that there is no way to archieve this without triggering manual coordinate transformations, wysota. I am, however, having problems even with that. I found the thread where spud claims to know how to draw the handles of an item scale- and rotation-invariant, however, the solution is not presented in the thread.
After trying out all kinds of different transformations, I found something that seems to yield the right result, but is not consistent with the documentation:
Qt Code:
QPen pen; pen.setWidthF(5./qAbs(painter->deviceTransform().m12()));To copy to clipboard, switch view to plain text mode
Qt's documentation says QTransform::m12() and m21() describe the shearing factors. They are for my (scaled, non-sheared) example however working: I get a pen with a constant size in pixels on my QGraphicsView. m11() and m22() on the other hand, which were supposed to describe the scaling, are constant zero.
So either I am doing this wrong, and this is just working by coincidence, or the documentation is wrong. I would be surprised by that though, as my intuition also says that scaling should be on the main diagonal of the transformation matrix..
I'll see if I can revive the before-mentioned old thread.
Bookmarks