Results 1 to 3 of 3

Thread: Using QWebView together with QHelpEngine

  1. #1
    Join Date
    Aug 2008
    Posts
    132
    Thanks
    23
    Thanked 3 Times in 3 Posts

    Default Using QWebView together with QHelpEngine

    Hi

    I've been struggling with this for days now. I generated help using Doxygen 1.7.1 which produces a website and a .qhc file.

    I am able to load the .qhc file using QTextBrowser and it loads fine, but QTextBrowser does not seem to support everything that is in the output, not sure if it is in the style sheet or in the javascript. I can view the file in QTextBrowser either by doing it as described in the good old "Using QtHelp to Lend a Helping Hand" Qt Quarterly article or by showing it directly using QTextBrowser::setSource().

    Since it seems like QTextBrowser is not able to display the page correctly, I turned to QWebView which shows it beautifully when loading the website directly using QWebView::setUrl(). However I need to use QHelpContentWidget for the indexing of the help file's content.

    Thus I do the following:

    Qt Code:
    1. // Set up the help engine:
    2. helpEngine = new HelpEngine("D:/doxygen_output/my_help.qhc", this);
    3. helpEngine->setupData();
    4.  
    5. // Create a help content widget:
    6. QHelpContentWidget* content_widget = new QHelpContentWidget();
    7. connect(content_widget,SIGNAL(linkActivated(const QUrl&)),SLOT(updateUrl(QUrl)));
    8.  
    9. // Create the webview:
    10. webView = new QWebView();
    11. webView ->show();
    12.  
    13. // webView and helpEngine are declared in the same class as the slot, thus the slot implementation has access to it.
    To copy to clipboard, switch view to plain text mode 

    In my updateUrl() slot I then do the following:
    Qt Code:
    1. void MyClass::updateUrl(const QUrl& url) {
    2. webView->setHtml(helpEngine->fileData(url),"D:/doxygen_output/");
    3. }
    To copy to clipboard, switch view to plain text mode 

    The above code works perfectly, however it misses the point of providing the help in only two files: .qhc and .qch.

    Thus my problem is: How can I let QWebView know that it should use a baseUrl which is a virtual folder in the helpEngine? Is this even possible at all?

    I've also tried the following but this does not work:
    Qt Code:
    1. void MyClass::updateUrl(const QUrl& url) {
    2. QString relative_url = url.toString();
    3. QStringList item_list = relative_url.split("/");
    4. item_list.pop_back();
    5. QString path_url = item_list.join("/");
    6. path_url.append("/");
    7. // At this stage path_url is: "qthelp://documentation_namespace/virtual_folder/"
    8. webView->setHtml(helpEngine->fileData(url),path_url);
    9. }
    To copy to clipboard, switch view to plain text mode 

    Thank you,
    Jaco

  2. #2
    Join Date
    Sep 2010
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    1

    Default Re: Using QWebView together with QHelpEngine

    Hi Jaco,
    Did you ever manage to fix this problem?

  3. #3
    Join Date
    May 2012
    Location
    Belgium
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Using QWebView together with QHelpEngine

    I think I'm going to bring this topic back to life.

    I have almost the same problem, but here the css isn't showing up. I tried to give a virtual path (QUrl("qthelp://com.mynaspace/doc")) and a existing path (QUrl("C:/MyApplication/doc")). None of them seem to be working.

    Any help would be welcome.

Similar Threads

  1. Replies: 8
    Last Post: 3rd September 2013, 10:51
  2. Using QHelpEngine
    By dima1000 in forum Newbie
    Replies: 1
    Last Post: 23rd January 2011, 01:48
  3. QHelpEngine, cannot open qhc file
    By hirti in forum Qt Programming
    Replies: 1
    Last Post: 11th June 2010, 16:05
  4. QWebView on S60
    By stepic in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 22nd April 2010, 21:40
  5. QWebView
    By ivi2501 in forum Qt Programming
    Replies: 1
    Last Post: 30th December 2008, 13:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.