[Qt-interest] translate path's coordinates

Ioannis Nousias s0238762 at sms.ed.ac.uk
Mon Jun 8 01:17:07 CEST 2009


actually, sorry, it's not deformed, rather 'cliped'. I realised it's due 
to the boundingRect(), which I pass to the update() method, not being 
'translated' as well.

now that the matrix has changed for that path, I need to manually 
'translate' the mouse pointer (I store a QMatrix per path and do 
matrix.inverted.map(mouse_point) to get the 'translated' pointer) in 
order for the highlight detection to work on that path, all of which 
looks hacky to me.

there must be a cleaner way to do this whole thing...

Ioannis Nousias wrote:
> Hello qt-devs
>
> Is there a way to change where a path is drawn? I've tried setting the 
> world matrix on the painter, but that did something I was not expecting. 
> The path got deformed.
>
> Basically, I have a little drawing tool. You draw shapes/paths with your 
> mouse. Each time you press the mouse button it starts a new path and 
> continues 'adding' to that path until you release the button. The paths 
> are stored in a list.
>
> When you hover over a path (the cursor is atop its contour), the shape 
> is highlighted and you are suppose to be able to move it around. I use 
> QPainterPathStroker and contains() to detect if the mouse is over a path.
>
> Any ideas? Is there some other neater way to do this whole thing (maybe 
> using QGraphicsView and QGraphicsItem's or something. At the moment I 
> just draw things on a QWidget)
>
> regards,
> Ioannis
>
>
>   


-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.




More information about the Qt-interest-old mailing list