I have seen that Qt integrates svg and also integrates javascript, but I have not found a way to execute the JavaScript embedded in a .svg
Does anyone know how to join these two functions in a Qt application?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to use QtWebKit to display your SVG file instead. Its SVG implementation can use the WebKit JavaScript engine. QtSvg cannot.
The simplest way is to create a QWebView widget. If you just want to verify that this works, compile the “fancybrowser” example included with the Qt source. I confirmed that “fancybrowser” can execute the inline JavaScript in an example SVG file from Matthew Bystedt’s blog, using Qt 5.0.0 on Windows. I would guess that Qt 4.8.4 also supports it, but I haven’t tried that myself.