PDA

View Full Version : Qt Svg Module



onurozcelik
12th March 2010, 15:00
Hi guys

I want to use QGraphicsSvgItems when modelling a visual object. So I inherit from QGraphicsSvgItem and reimplement paint.
I want my visual object to have different behavior when IO interaction like mouse click occurs.

For example lets assume I have a svg graphic that contains a red rectangle. When a mouse click occurs I want my rectangle to have flashing effect.(maybe animation or something like that)

1- Can it be achieved in one svg file or multiple svg files.
2- If it can be only achievd with multiple svg files will it be a poor choice because of loading svg files needs to access to disk again and again.

Can someone help me about these issues?

wysota
13th March 2010, 09:45
Can what be achieved with one svg file? So far I don't see the use for multiple files here - you have an svg item and you wish to do something with it.

onurozcelik
13th March 2010, 18:32
yes I have svg items I wish to do something with them when a user interaction occurs. For instance when I click on svg item i want to change its background color. Is it possible with one svg file? How?

ChrisW67
13th March 2010, 22:19
Looks like you need to identify two sub-drawings in your SVG file and then use QGraphicsSvgItem::setElementId() to select the one you wish to have the item draw.

wysota
14th March 2010, 00:23
Is it possible with one svg file? How?

Paint the background and then render the svg.

onurozcelik
14th March 2010, 07:47
ChrisW67

I created sub-drawings and then use setElementId to select one it is working perfectly on static svg drawings. But when I use svg animation elements in svg drawing and then I use setElementId function to select animated drawing the animation does not work, the animation is working if it do not use setElementId

wysota
Interesting idea it will give a try