Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt help file distribution

Qt help file distribution

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
4 Posts 2 Posters 1.4k Views
  • 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.
  • D Offline
    D Offline
    deleted362
    wrote on last edited by
    #1

    Hi all,
    My application has integrated help implemented with QHelpEngine and QTextBrowser. I have created both compressed help file and collection file and everything seems to be working on my PC. But when I try to build and run my app on another PC I receiver the error "QTextBrowser: No document for qthelp.//...". I put the compressed help file and collection file in the same folder with app binary.

    So my question are: should I make some additional steps concerning help files during the program installation (e.g. register compressed help file)? Is this possible to include help file in the resource file? Are any good examples for creating Windows installers, Linux binary packages (e.g. deb and rpm) for the programs which include Qt help files?

    P.S. I am using Qt 5.6.1 shipped with Ubuntu 16.10.

    Thanks in advance!

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

      Hi and welcome to devnet,

      Can you show the code you are using to load the file ?

      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
      • D Offline
        D Offline
        deleted362
        wrote on last edited by
        #3

        The two classes HelpBrowser and HelpWidget are responsible for displaying the help content.

        HelpWidget is following:

        class HelpWidget : public QSplitter
        {
            Q_OBJECT
          public:
                HelpWidget(QWidget *parent = 0);
        
           private:
                QHelpEngine* help_engine_;
                HelpBrowser *help_browser_;
                QTabWidget* tab_widget_;
        
                void connectSignalsAndSlots();
                void setupTabWidget();
                void insertWidgets();
         };
        
        HelpWidget::HelpWidget(QWidget *parent) : QSplitter(Qt::Horizontal, parent),
            help_engine_(new QHelpEngine("my_manual.qhc", this)),
            help_browser_(new HelpBrowser(help_engine_, this)),
            tab_widget_(new QTabWidget(this))
        {
            help_engine_->setupData();
            setupTabWidget();
            help_browser_->setSource(QUrl("qthelp://mycompany.myapp.1.0/app/app_manual.html"));
            connectSignalsAndSlots();
            insertWidgets();
        }
        
        void HelpWidget::connectSignalsAndSlots()
        {
            connect(help_engine_->contentWidget(), SIGNAL(linkActivated(QUrl)), 
                            help_browser_, SLOT(setSource(QUrl)));
            connect(help_engine_->indexWidget(), SIGNAL(linkActivated(QUrl, QString)), 
                            help_browser_, SLOT(setSource(QUrl)));
        }
        
        void HelpWidget::setupTabWidget()
        {
            tab_widget_->setMaximumWidth(200);
            tab_widget_->addTab(help_engine_->contentWidget(), tr("Contents"));
            tab_widget_->addTab(help_engine_->indexWidget(), tr("Index"));
        }
        
        void HelpWidget::insertWidgets()
        {
            insertWidget(0, tab_widget_);
            insertWidget(1, help_browser_);
        }
        
        

        And HelpBrowser:

        class HelpBrowser : public QTextBrowser
        {            
          public:
                HelpBrowser(QHelpEngine* helpEngine, QWidget* parent = 0){}
                QVariant loadResource (int type, const QUrl& name);
                virtual ~HelpBrowser() {}
          private:
                QHelpEngine* help_engine_;
        };
        
        QVariant HelpBrowser::loadResource(int type, const QUrl &name)
        {
            if (name.scheme() == "qthelp")
                return QVariant(help_engine_->fileData(name));
            else
                return QTextBrowser::loadResource(type, name);
        }
        
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You should always use fullpaths when dealing with external files like that. The working directory might not be what you expect it to be when your application is run.

          As for deploying the help files. Depending on its size your can use Qt's resources so it's embedded in there.

          Otherwise it depends on your target platform. You can use Qt's installer framework to build an installer that can work cross-platform.

          If you'd rather provide packages for specific linux distributions, then you should follow these distribution packaging documentation.

          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

          • Login

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