Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    HTML5 from Resource

    General and Desktop
    1
    2
    687
    Loading More Posts
    • 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.
    • S
      silur last edited by

      Hi
      I'd like to protect my HTML5 application's html file by loading it from a resource file "foo.qrc"
      @
      <RCC>
      <qresource prefix="/">
      <file>index.html</file>
      </qresource>
      </RCC>
      @
      My Code:

      @ QFile f(":/index.html");
      if (f.open(QIODevice::ReadOnly))
      {
      qDebug() << "OK";
      qDebug() << f.readAll();
      }
      else
      {
      qDebug() << "Failed";
      }

      viewer.loadFile(":/index.html");

      return app.exec(&#41;;
      

      }
      @
      Now my QFile part with the qdebug returns the content of my HTML file, my qrc file and my syntax is ok, but my viewer doesn't load it, it's just a plain white page, and when i click reload on the pop-up menu my app crashes...

      1 Reply Last reply Reply Quote 0
      • S
        silur last edited by

        Problem solved with:

        @
        viewer.webView->setHtml(f.readall());
        @

        1 Reply Last reply Reply Quote 0
        • First post
          Last post