HTML5 from Resource



  • 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...



  • Problem solved with:

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


Log in to reply
 

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