Languages/Python/PyKDE WebKit Tutorial/Part4

From KDE TechBase
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Now we want to prepare to add an address bar.

Replace the __init__ method with:

       self.widget = QWidget()
       layout = QVBoxLayout(self.widget)
       self.web = QWebView(self.widget)
       self.web.load(QUrl("http://kubuntu.org"))
       layout.addWidget(self.web)
       self.widget.show()

Now instead of having the QWebView as our top widget we have a plain QWidget. This widget contains a layout which is not a visible widget but ensure child widgets are put in a sensible place. It is a QVBoxLayout which will put widgets in a vertical colum.

See the full code.

This version will look the same as the previous.

« Back to Part 3 | On to Part 5 »