PDA

View Full Version : Mouse mapping on QTransform problem



captchaq
26th September 2008, 17:35
Hi to all,

If i set a QTransform on a widged class
trans = QTransform(1.2,0.,0.,1.2,0.,0.); scale 1.2 zoom
and i paint on a p->setWorldTransform(trans,false);
Why on mouse event QTransform can not mapping correct point?

QPointF translatet_point = trans.map(event->pos());
if i debug trans.m11() it return correct 1.2 and point x,y is map 1:1

Danny

jacek
26th September 2008, 18:20
Your QTransform transforms painter coordinates to widget coordinates. event()->pos() returns a point in widget coordinates, so you have to apply the reverse transform to get painter coordinates.

captchaq
26th September 2008, 19:11
Your QTransform transforms painter coordinates to widget coordinates. event()->pos() returns a point in widget coordinates, so you have to apply the reverse transform to get painter coordinates.


Only get
QTransform QTransform::inverted ( bool * invertible = 0 ) const
and thats it? i try..