Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. QWebView does not refresh [SOLVED]
QtWS25 Last Chance

QWebView does not refresh [SOLVED]

Scheduled Pinned Locked Moved Qt WebKit
5 Posts 3 Posters 4.8k 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.
  • L Offline
    L Offline
    leo4as
    wrote on last edited by
    #1

    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

    leo4as

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      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.

      157

      1 Reply Last reply
      0
      • L Offline
        L Offline
        leo4as
        wrote on last edited by
        #3

        thank you it's working now :)

        leo4as

        1 Reply Last reply
        0
        • p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          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.

          157

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5
            This post is deleted!
            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