Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Open pdf using OS chosen application through QML html page
Moschops last edited by
I have a big chunky desktop application written in QT. Tucked away, it has some QML. One of the actions of this QML is to show the user an html page (within the QT application). I would like the user to be able to click something in that page that causes a pdf file to be displayed using their OS pdf reader of choice.
On an html page in a standard browser this would be something simple like
@ <a href="/path/to/file/.pdf">Open PDF file</a>@
Doing this in the QML handled html page I have here leads to a response along the lines of
@gvfs-open: qrc:///QML-directory-containing-html-file/~/myfile.pdf: error opening location: The specified location is not supported@
Presumably this is because the QML code runs in its own sub-ecosystem of some kind (everything I've mentioned looks to be buried in a qrc resource file, imaginatively named resource.qrc). I see there is a function openURLExternally() that might do it, but how do I make that happen when something is clicked in this html page?
I do apolgise for the simplicity of this; I'm so new to QML that I struggle even to know how to work the questions I ask.