The MiniBrowser just works!
But it has to be improved in many ways before we start to feel comfortable using it.
To correct the first point, we could change the implementation of on_btnNavigate_released as follows:
As for the second and third points, we should get the MainWindow class to receive two more signals.
We definitely have to take a look at the Qt documentation (which is the right thing to do as we want to develop software using the Qt framework, and it is easily accesible either through the eric4 help viewer or by using the Qt assistant tool).
We need to get familiar with the signal/slots language construct.
We also need to take a look at the QWebView class reference. We will find that there are a couple signals that will be useful: titleChanged() and urlChanged().
From the Qt documentation, we learn that these signals 'are emitted whenever the title of the main frame changes/the url of the view changes'.
To get this signals attached to slots in the MainWindow class, we right-click on the mainwindow.ui item (project viewer, forms tab) and select again Generate dialog code.... We have already done this sort of thing in chapter 2.
As this is the second time we perform this action for this form, we don't need to create a new class and/or file.
Furthermore, we can see that on_btnNavigate_released is already checked (as we had left it a while ago).
Now we have to check the methods on_webView_titleChanged and on_webView_urlChanged for the webView item.
We click on Ok and we will find that some new code has been added to the MainWindow class.
As before, we find the @pyqtSignature decorator. This time, it specifies which type of object are received of parameters by the corresponding these methods (QString, QUrl; read on these in the Qt class reference if you are not familiar to).
Like before, the code created by eric4 also keeps a place for documenting our code, it adds some todo-comments, and it raises 'not implemented' errors.
To solve the aforementioned points (title that doesn't refresh, url that doesn't refresh), we just have to code these methods as follows:
There are still other improvements that could be carried out this way.
For instance, we could use the signal loadProgress(), which 'is emitted every time an element in the web page completes loading and the overall loading progress advances' (see QWebView documentation).
We could use it to display a nice progress bar displaying the overall load status of the page we are visiting.