QWebView does not refresh [SOLVED]



  • i have qwebview to display local resource file (code.html)
    @ui->webView->load(QUrl("qrc:/website/resources/code.html"));@

    it works for the first time but when i edit the file (code.html) qwebview does not refresh/reload it !!
    i must close and reopen the app to get it
    i tried every thing
    @
    ObjectCreator::ObjectCreator(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ObjectCreator)
    {
    ui->setupUi(this);
    ui->webView->settings()->setObjectCacheCapacities(0,0,0);
    ui->webView->triggerPageAction(QWebPage::ReloadAndBypassCache);
    ui->webView->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true);
    ui->webView->load(QUrl("qrc:/website/resources/code.html"));
    }

    void ObjectCreator::on_refresh_clicked()
    {
    ui->webView->reload();
    ui->webView->repaint();
    ui->webView->update();
    }
    @

    but nothing works :(

    Qt 5.4
    please help
    thanks


  • Moderators

    Hi,

    It seems you are editing the file which is in Qt Resource System which gets embedded into the executable. The new changes will be added to the executable only when you recompile the application i.e which you have already experienced. To make it work at the runtime, try loading a file outside the Resource and make changes and then refresh.



  • thank you it's working now :)


  • Moderators

    Glad that its working. You're Welcome :)
    You might also want to look at "Qt Resource System":http://doc.qt.io/qt-5/resources.html.



  • This post is deleted!

Log in to reply
 

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