Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. HTML5 from Resource
QtWS25 Last Chance

HTML5 from Resource

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 791 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.
  • S Offline
    S Offline
    silur
    wrote on last edited by
    #1

    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
    0
    • S Offline
      S Offline
      silur
      wrote on last edited by
      #2

      Problem solved with:

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

      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