[QGIS-Developer] Use of QtWebKit in plugin

kjoller niels.k.h at gmail.com
Mon Jun 19 04:48:07 PDT 2017

Hi all

I have been trying to fix a bug in the "Kortforsyningen" plugin for QGIS,
which exists in Ubuntu 17.04 and Debian stretch (and probably other newer
debian based systems), due to QtWebKit not being included in PyQt4


The basic trouble is:
ImportError: No module named QtWebKit.QWebView

I have narrowed it down to the the (rather complex) 'About' dialog, where 

    os.path.join(os.path.dirname(__file__), 'aboutKortforsyningen.ui')

tries to run a piece of code ending with the line

from QtWebkit.QWebView import QWebView

where on my working (16.04) system, it ends with

from PyQt4 import QtWebKit

I can solve this problem, by putting qtwebkit.py from the PyQt4 source code
into /usr/lib/python2.7/dist-packages/PyQt4/uic/widget-plugins.

My question boils down to:

What is the 'best' way of solving this in other peoples systems? I have
looked at three scenarios:

* Switching to a simpler about dialog in case of QtWebkit-errors (a hacky
* Precompiling the UI on a working system before uploading(1)
* Begging to get the widget-plugin file included in the .deb-package on
* ?


(1) When I try to use pyuic4 -o aboutKortforsyningen.py
aboutKortforsyningen.ui -d on my working system, I get 

ValueError: API 'QDate' has already been set to version 1

which I can solve buy adding sip.setapi(....) to the start of pyuic4, but is
this can't be the way to do it, can it?

View this message in context: http://osgeo-org.1560.x6.nabble.com/Use-of-QtWebKit-in-plugin-tp5324658.html
Sent from the QGIS - Developer mailing list archive at Nabble.com.

More information about the QGIS-Developer mailing list