Kabie
Kabie

Reputation: 10663

How to prevent QtWebkit load images?

I don't need images in the page loaded in QWebView. With a minimum example, how do I do it?:

import sys
from PyQt4 import QtCore, QtGui, QtWebKit

if __name__ == '__main__':

    app = QtGui.QApplication(sys.argv)
    w = QtWebKit.QWebView()
    url = QtCore.QUrl("http://www.google.com")
    w.load(url)
    w.show()

I only found this. However QtWebkit seems not work that way.

Upvotes: 1

Views: 924

Answers (1)

Kabie
Kabie

Reputation: 10663

OK, I found QWebSettings::AutoLoadImages.

So, basically:

# before loading the url:
st=w.settings()
st.setAttribute(st.AutoLoadImages,False)

would do the trick.

Upvotes: 6

Related Questions