PDA

View Full Version : Loving Qt and Qt4 Designer but hit a wall with SVG



Whippy
19th August 2011, 10:11
I'm programming using PyQt and Qt4 Designer and enjoying the great productivity they provide.

I have a working application and need quite a sophisticated interface to it. Qt Designer has been fantastic and I have a great UI that looks to do almost everything I need.

The application includes the presentation of information on SVG maps. I lifted svg_view from the svgviewer example and it provided a great widget allowing me to zoom and pan the map exactly the way I wanted.

However QtSvg currently allows no SVG DOM manipulation - I need to be able to change the loaded map and respond to mouse events in the context of the svg elements (e.g. colour a moused territory (shape), highlight a route...) - the sort of thing I could do easily with jquerysvg (http://keith-wood.name/svg.html) on a webpage (where the complexities of the rest of the GUI requirement left me floundering)

Is there any possibility of an interactive SVG widget where the DOM could be manipulated in response to events triggered from the SVG elements?

It seems harsh to have such a tantalising capability to display the SVG while being unable to take advantage of SVG's real power in terms of its interaction potential.

Does anyone know if/where/how I can get hold of an interactive SVG widget for Qt?

wysota
19th August 2011, 10:25
QtWebKit has a more complete SVG support, you should be able to use it. Your jquerysvg should work with it too.

Whippy
20th August 2011, 11:06
Thanks wysota,

I will look into QtWebkit further. I'm not sure how I can tie the javascript in the webkit displayed page with the rest of the application/interface.

wysota
20th August 2011, 13:20
You can use WebKit for SVG rendering and manipulation and handle the rest in the usual way.

ChrisW67
21st August 2011, 03:02
Why are the facilities of the QtXml module insufficient to manipulate your SVG document? SVG is just an application of XML and you have DOM and SAX access paths, in QtXML, along the XSLT, XPath, XQuery, and schema validation in QtXmlPatterns.