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. Share Files between different Qt Help Project Files
Qt 6.11 is out! See what's new in the release blog

Share Files between different Qt Help Project Files

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 514 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.
  • A Offline
    A Offline
    alexkorr
    wrote on last edited by alexkorr
    #1

    Hi

    I would like to share Javascript source files between different Qt Help Project files. Example:

    I have two qhp files

    helpA.qhp

    <?xml version="1.0" encoding="UTF-8"?>
    <QtHelpProject version="1.0">
    <namespace>namespaceA</namespace>
    <virtualFolder>doc</virtualFolder>
    <filterSection>
    <toc>
    <section title="Title Help A" ref="indexA.html">
    </section>
    </toc>
    <files>
    <file>script.js</file>
    </files>
    </filterSection>
    </QtHelpProject>
    

    helpB.qhp

    <?xml version="1.0" encoding="UTF-8"?>
    <QtHelpProject version="1.0">
    <namespace>namespaceB</namespace>
    <virtualFolder>doc</virtualFolder>
    <filterSection>
    <toc>
    <section title="Title Help B" ref="indexB.html">
    </section>
    </toc>
    </filterSection>
    </QtHelpProject>
    

    For both files indexA.html and indexB.html I am referencing the javascript using:

    <script src="script.js"></script>
    

    When I compress helpA.qch then the javascript is properly loaded. However in helpB.qch the javascript is not found. I was thinking this should be fine, since both help project files specify the same virtual folder.

    How can I share files between different .qch files?

    Thanks and best regards

    1 Reply Last reply
    0
    • jeremy_kJ Offline
      jeremy_kJ Offline
      jeremy_k
      wrote on last edited by jeremy_k
      #2

      The URLs passed to QTextEdit::loadResource() in my project are qthelp://<namespace>/<virtualFolder>/<relative path...>. Based on this, I presume that sharing between namespaces can be accomplished referencing an absolute path including the namespace and virtual folder, or a relative path that ascends the parent hierarchy as appropriate.

      An alternative is to check for script.js in every request.

      Edit: QUrl::host() reports the namespace. A relative path using ../ doesn't appear to be an option.

      Asking a question about code? http://eel.is/iso-c++/testcase/

      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