I'm creating an application using PyQt4 to be able to view an inline text HTML mark-up without loading a local HTML file from the system. But, i got some problem with the string format of the HTML.This code is showing only the Window not the HTML text. Please help.
# imported all the modules
class HtmlView(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
.................
# i've skipped the layout definition here
................
# an inline text with html mark-up
text = "<p>This is a paragraph</p><div>This is inside div element</div>"
self.html = QtWebKit.QWebView()
# setting layout
self.gridLayout.addWidget(self.html)
self.mainLayout.addWidget(self.frame)
self.setCentralWidget(self.centralwidget)
self.web_page = text
url = self.web_page
self.html.load(QtCore.QUrl(url))
self.html.show()
# executing using if __name__ == "main": skipped this part
And please tell me how to change the style of elements <p> and <div> inside the QWebView().