title: QWebEngineView update with pdf path
body: <p>I have a <code>QtWebEngineWidgets</code> showing some pdf files. I want to change pdf and force <code>QtWebEngineView</code> display automatically and dynamically. The problem I get is the <code>QtWebEngineWidgets</code> does not update, incapabile to display when pdf file path changes. </p>
  
  <pre><code>class PdfReport(QtWebEngineWidgets.QWebEngineView):
      PDFJS = 'file:///pdfjs/web/viewer.html'
      def __init__(self, parent=None):
          super(PdfReport, self).__init__(parent)
          self.PDF = 'file:///Technicalreport/file0.pdf'
          self.load(QtCore.QUrl.fromUserInput('%s?file=%s' % (PDFJS, self.PDF))) 
  
      @QtCore.pyqtSlot(int)    
      def index_load(self, _index):
          self._index = _index
          self.PDF = pdfpath(self._index)
  </code></pre>
  
  <p>Outer function:</p>
  
  <pre><code>def pdfpath(index):
      if index == -1:
          PDF = 'file:///Technicalreport/file0.pdf'
      else:
          PDF = 'file:///Technicalreport/file%d.pdf' %index
      return PDF
  </code></pre>
  
  <p>tried to test function and returns as expected:</p>
  
  <pre><code>for i in range(3):
      print(pdfpath(i), type(pdfpath(i)))
  
  file:///Technicalreport/file0.pdf &lt;class 'str'&gt;
  file:///Technicalreport/file1.pdf &lt;class 'str'&gt;
  file:///Technicalreport/file2.pdf &lt;class 'str'&gt;
  </code></pre>
  
  <p>Yes pdf files <code>'file0'</code>, <code>'file1'</code> and <code>'file2'</code> exist:</p>
  
  <p>When it runs gets this error:</p>
  
  <pre><code>TypeError: 'module' object is not callable
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <pre><code>import sys
  from PyQt5 import QtCore, QtWidgets, QtWebEngineWidgets
  
  PDFJS = 'file:///pdfjs/web/viewer.html'
  PDF = 'file:///Technicalreport/file0.pdf'
  
  def pdfpath(index):
      if index == -1:
          PDF = 'file:///Technicalreport/file0.pdf'
      else:
          PDF = 'file:///Technicalreport/file%d.pdf' %index
      return PDF
  
  
  class Foo(QtWidgets.QWidget):
      def __init__(self, parent=None):
          super(Foo, self).__init__(parent)
          self.setGeometry(QtCore.QRect(200, 100, 800, 800))
  
          self.pdf = Window()
          self.com = Widget()
          self.lay = QtWidgets.QVBoxLayout(self)
          self.lay.addWidget(self.pdf)
          self.lay.addWidget(self.com)
  
          self.com.IndexChanged.connect(self.pdf.index_load)
  
  
  class Window(QtWebEngineWidgets.QWebEngineView):
  
      def __init__(self, parent=None):
          super(Window, self).__init__(parent)
          self.PDF = PDF
          self.load(QtCore.QUrl.fromUserInput('%s?file=%s' % (PDFJS, self.PDF)))            
  
      @QtCore.pyqtSlot(int)    
      def index_load(self, _index):
          self._index = _index
          self.PDF = pdfpath(self._index)
          print(self.PDF,'=', self._index)
  
  
  
  class Widget(QtWidgets.QWidget):
      IndexChanged = QtCore.pyqtSignal(int)
      def __init__(self, parent=None):
          QtWidgets.QWidget.__init__(self, parent)
          self.setLayout(QtWidgets.QVBoxLayout())
          self.combo = QtWidgets.QComboBox(self)
          self.layout().addWidget(self.combo)
          self.combo.addItems(["item1", "item2", "item3"])
          self.combo.setMinimumWidth(150)
          self.combo.activated[int].connect(self.onActivatedIndex)
  
      @QtCore.pyqtSlot(int)
      def onActivatedIndex(self, index):
          self.IndexChanged.emit(index)
  
  
  if __name__ == '__main__':
  
      app = QtWidgets.QApplication(sys.argv)
      window = Foo()
      window.setGeometry(600, 50, 800, 600)
      window.show()
      sys.exit(app.exec_())
  </code></pre>
  
  <p><strong>Display:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/0msnV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0msnV.png" alt="enter image description here"></a></p>