How to open a local URL with QWebEngineView



  • I am trying to load and show some local urls with QWebEngineView which are based on QtHelp in my application, but it is not possible. I have just managed to load either the HTML code or the text inside it thanks to a QHelpEnginem, but it is not possible to load the images, and the linking inside it does not work either. The urls could be previously displayed with QTextBrowser, but since I want to add some more advanced functionality to the html I would like to change to the QWebEngineView.

    Does anybody know how to do this, or if it is possible at all? Is it necessary to modify the base url?


  • Moderators

    Hi, welcome to devnet.

    QWebEngineView is a component for displaying web or web-like content so this question can be answered by asking this cunning question: how would you like if random web pages could browse your computer for images whenever they wanted? I bet you wouldn't ;)



  • Hi,

    does Chris' answer imply that there is no way (or 'simple' way) to render Qt help from resource files with HTML support beyond the QTextBrowser functionality?

    If there is an alternative, does anybody have a hint?

    Regards,
    Hauke


  • Moderators

    I might be wrong about this. If it's all in the same "domain" as the HTML ie. the resource file or local file, it might be ok, but I have no way to check right now.

    If it's an embedded resource you might try urls "qrc:///foo/bar.jpg" and for local files "file:///C:/foo/bar.jpg" but I doubt you can mix any of the two with HTML injected "from code".


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.