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. QHelpEngineCore::documentsForKeyword() doesn't work
Forum Updated to NodeBB v4.3 + New Features

QHelpEngineCore::documentsForKeyword() doesn't work

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 3 Posters 667 Views 2 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
    mireiner
    wrote on last edited by mireiner
    #1

    Hi there,

    Qt documenation says following member function is obsolete:
    https://doc.qt.io/qt-5/qhelpenginecore-obsolete.html

    QMap<QString, QUrl> QHelpEngineCore::linksForKeyword(const QString &keyword) const
    and should be replaced by
    QList<QHelpLink> QHelpEngineCore::documentsForKeyword(const QString &keyword) const

    I did that replacement. But whereas linksForKeyword(QString) works fine documentsForKeyword(QString) doesn't. Here my code:

    // Qt version 5.15.0
    // Compiler option: CONFIG += c++1z
    
    #include <QHelpEngine>
    #include <QMap>
    #include <QList>
    #include <QString>
    #include <QUrl>
    #include <QHelpLink>
    
    QString helpDoc = QApplication::applicationDirPath() + QString("MyHelpDocument.qhc");
    QHelpEngine* helpEngine = new QHelpEngine(helpDoc);
    if (!helpEngine->setupData()) {
        // cleanup and return
    }
    
    QMap<QString, QUrl> links1 = helpEngine->linksForKeyword("MyKeyword");  // 1 link found
    QList<QHelpLink> links2 = helpEngine->documentsForKeyword("MyKeyword"); // 0 link found
    QList<QHelpLink> links3 = helpEngine->documentsForKeyword("MyKeyword", ""); // 0 link found
    // Using 'auto' for links.. declaration makes no difference
    

    Why doesn't documentsForKeyword() find any link here?

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #6

      Found it, you forgot to enable the new help engine: QHelpEngineCore::setUsesFilterEngine(true).

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      M 1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi,

        Maybe you found an issue. Can you provide a minimal compilable example that shows your issue ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mireiner
          wrote on last edited by mireiner
          #3

          Hi SGaist,

          here's a minimal test application:
          Dropbox download

          For proper functioning shadow-build has to be disabled in Qt-Creator's build properties. Otherwise the application won't find the path to the help files.

          If the download doesn't work or you need more files of the project please let me know.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by SGaist
            #4

            @mireiner said in QHelpEngineCore::documentsForKeyword() doesn't work:

            documentsForKeyword

            You may have found something.You should check the bug report system to see if there's already something related. If not, then please open an new issue providing your minimal example.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • Christian EhrlicherC Online
              Christian EhrlicherC Online
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by Christian Ehrlicher
              #5

              I don't think it's a Qt bug - QHelpCollectionHandler::linksForField() (the internal function called by QHelpEngineCore::linksForKeyword() ) is calling QHelpCollectionHandler::documentsForField() which is exactly what QHelpEngineCore::documentsForKeyword() is calling.

              /edit: I'm looking at the current 5.15dev codebase. The change can be found here: https://codereview.qt-project.org/c/qt/qttools/+/291144

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              1
              • Christian EhrlicherC Online
                Christian EhrlicherC Online
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #6

                Found it, you forgot to enable the new help engine: QHelpEngineCore::setUsesFilterEngine(true).

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                M 1 Reply Last reply
                1
                • Christian EhrlicherC Christian Ehrlicher

                  Found it, you forgot to enable the new help engine: QHelpEngineCore::setUsesFilterEngine(true).

                  M Offline
                  M Offline
                  mireiner
                  wrote on last edited by
                  #7

                  @Christian-Ehrlicher said in QHelpEngineCore::documentsForKeyword() doesn't work:

                  Found it, you forgot to enable the new help engine: QHelpEngineCore::setUsesFilterEngine(true).

                  Hi Christian,
                  you're my hero - that really works. Never would have found this solution for my own.

                  Now I wonder what the meaning of this "filter" is. Did not know that I was using a "filter" that had to be enabled by code.

                  Can you please lead me to the part of the Qt help documentation where the "filter" is fully explained?

                  Thank you very much for your help!

                  1 Reply Last reply
                  0
                  • Christian EhrlicherC Online
                    Christian EhrlicherC Online
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #8

                    @mireiner said in QHelpEngineCore::documentsForKeyword() doesn't work:

                    Can you please lead me to the part of the Qt help documentation where the "filter" is fully explained?

                    This one? https://doc.qt.io/qt-5/qhelpenginecore.html#details

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    M 1 Reply Last reply
                    0
                    • Christian EhrlicherC Christian Ehrlicher

                      @mireiner said in QHelpEngineCore::documentsForKeyword() doesn't work:

                      Can you please lead me to the part of the Qt help documentation where the "filter" is fully explained?

                      This one? https://doc.qt.io/qt-5/qhelpenginecore.html#details

                      M Offline
                      M Offline
                      mireiner
                      wrote on last edited by
                      #9

                      @Christian-Ehrlicher said in QHelpEngineCore::documentsForKeyword() doesn't work:

                      This one? https://doc.qt.io/qt-5/qhelpenginecore.html#details

                      Thanks for the help link. I have to read over the whole help documention again more carefully. The filter might be also implemented in the help project file *.qhp.

                      https://doc.qt.io/qt-5/qthelpproject.html

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #10

                        @Christian-Ehrlicher good catch ! I have missed that line.

                        I think it deserves a more prominent styling. I'll see to improve that.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        2

                        • Login

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