Hey Mohammed, 2012/7/26 Mohammed Rashad <[email protected]>: > I have a couple of WPainter questions > > I zoom the WPaintedWidget using > > painter.setWindow(0,0,width+zoomDelta,height+zoomDelta) > > this code will zoom my window > > but after zooming my mouse event are not giving coordinates properly
In fact, your mouse coordinates should not be affected by this 'zoom' function -- it simply transforms how one paints. > mouseEvent.widget().x and mouseEvent.widget().y are bit shifted from the > actual position where i clicked on screen Actually, these should be correct (and not affected by the zoom), instead if you want to map back these coordinates to things you drew, you will need to process them through the inversed transformation. You could do that by saving the correct inverse transform during painting (after you've called setWindow()). inverseTransform_ = painter.combinedTransform().inverted() And then use inverseTransform_.map() on the mouse widget coordinates. > How can I get the mousePoisition based on the new window > > in WMouseEvent class there are some functions called screen,window,widget > etc... > > what are they used for?? These relate to coordinates with different references. The one you need is the coordinates relative to your painted widget, i.e. widget(). Regards, koen > > > > -- > Regards, > Rashad > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
