Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Open pdf using OS chosen application through QML html page
Qt 6.11 is out! See what's new in the release blog

Open pdf using OS chosen application through QML html page

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 953 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Moschops
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved