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. How to create a table of contents with QTextDocument
Qt 6.11 is out! See what's new in the release blog

How to create a table of contents with QTextDocument

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

    Hello Qt friends,

    I would like to know if there is a way to create a table of contents in a QTextDocument.

    I have tried with HTML anchor <a href="#ref"> tag, which works well with QTextBrowser, but when saving as PDF file the links don't work, even when saving as ODT, so I would like to know if through Qt's own classes it is possible to create a table of contents, or maybe you can recommend me to use an external library.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      As far as i know its not possible to make real PDF bookmarks in Qt
      Ther was talk about it and there is a patch
      https://bugreports.qt.io/browse/QTBUG-3893
      but that jonas person seems to have vanished and so is patch.

      I think http://podofo.sourceforge.net/
      can create bookmarks but i never tried it.

      Also
      https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/
      can do bookmarks via commandline so if its an option to call it using QProcess as a post processor that could
      also maybe be a solution.

      1 Reply Last reply
      1
      • P Offline
        P Offline
        P1kk0r0
        wrote on last edited by
        #3

        Thank you. I will check those libraries.

        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