Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. qt 5.6 WebEngine open local html file

qt 5.6 WebEngine open local html file

Scheduled Pinned Locked Moved Unsolved QtWebEngine
2 Posts 2 Posters 2.7k 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
    dgsstan
    wrote on last edited by
    #1

    Hi,

    I am very new to qt and I am trying to open a local html file.
    I am using qt 5.6 and using the example file from qt example but it shows me how to open html file on the web.

    I tried changing url in main.qml file to the following:
    url: "qrc:/minimal/html/index.html"

    I place my html folder in minimal folder where the main.qml is located.

    When I run the application it says cant find the page.
    I tried looking at other help pages on source forge and this forum and was unable to get it to work as they were for older qt version.

    Can someone please help me out?

    Thank you
    Stan

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Matthias1
      wrote on last edited by
      #2

      Using qrc worked for me (Qt 5.8). Are you sure you added the file to the qml.qrc file?

      Should look something like

      qml.qrc

      <RCC>
          <qresource prefix="/">
              ...
              <file>minimal/html/index.html</file>
          </qresource>
      </RCC>
      

      and in the qml

      WebEngineView {
          anchors.fill: parent
          url: "qrc:/minimal/html/index.html"
      }
      

      I believe the url just follows the same scheme as in this S/O answer, so you should also be able to use something like file:///yourpath/minimal/html/index.html

      1 Reply Last reply
      1

      • Login

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