[Qgis-developer] QGIS Custom Widget in Qt Designer

Marco Bernasocchi marco at opengis.ch
Wed Dec 7 12:24:07 PST 2016


Sorry i might have a bit unclear.  I know that it works if in the promoted widget you put PyQt4.QtWebKit (or qgis.PyQt....)

What Im wondering is how this other plugins can work using QtWebKitWidgets

Ciao

On 8 December 2016 08:45:20 GMT+13:00, Marco Bernasocchi <marco at opengis.ch> wrote:
>Hi Denis, 
>I was just put of by the fact that the xml tag is called customwidget.
>
>They are in fact promotet widgets. And I really wonder how this can
>work.
>
>Could you try the resource sharing plugin. Does it work for you?
>
>Ciao
>
>
>
>On 8 December 2016 02:16:55 GMT+13:00, Rouzaud Denis
><denis.rouzaud at gmail.com> wrote:
>>Hi Marco,
>>
>>This doesn’t sound like a QGIS custom widget issue since QWebView is
>>not related to QGIS.
>>It seems that QWebView is well defined in PyQt4 compatibility layer
>>[0].
>>The issue is probably that you try to run system uic instead of
>>qgis.PyQt.uic.
>>
>>This make me thunk of the reply to Matteo as well….try to run
>>qgis.PyQt.uic instead of uic
>>
>>I hope this helps
>>
>>Denis
>>
>>[0]
>>https://github.com/qgis/QGIS/blob/release-2_18/python/PyQt/PyQt4/QtWebKitWidgets.py#L32
>><https://github.com/qgis/QGIS/blob/release-2_18/python/PyQt/PyQt4/QtWebKitWidgets.py#L32>
>>
>>
>>
>>
>>> On 7 Dec 2016, at 12:51, Marco Bernasocchi <marco at opengis.ch> wrote:
>>> 
>>> Salut Denis,
>>> 
>>> I'm a bit lost, I see in plugins like the resources sharing tool [0]
>>> 
>>> <customwidgets>
>>>  <customwidget>
>>>   <class>QWebView</class>
>>>   <extends>QWidget</extends>
>>>   <header>QtWebKitWidgets/QWebView</header>
>>>  </customwidget>
>>> </customwidgets>
>>> 
>>> and when I install the plugin I see:
>>> 
>>> This plugin is broken
>>> No module named QtWebKitWidgets.QWebView
>>> 
>>> this plugins also use the uic.loadUi approach
>>> 
>>> I've qgis installed from packages and also self build:
>>> marco at placebo:~/dev/QGIS/master/python/custom_widgets$ locate
>>> libqgis_customwidgets.so
>>>
>>/usr/lib/x86_64-linux-gnu/qt4/plugins/designer/libqgis_customwidgets.so
>>>
>>/usr/lib/x86_64-linux-gnu/qt4/plugins/designer/libqgis_customwidgets.so.2.18.1
>>> marco at placebo:~/dev/QGIS/master/python/custom_widgets$ locate
>>> qgis_customwidgets.py
>>>
>>/home/marco/dev/QGIS/master/python/custom_widgets/qgis_customwidgets.py
>>>
>>/home/marco/gis_data/pacsafe/QGIS/python/custom_widgets/qgis_customwidgets.py
>>>
>>/usr/lib/python2.7/dist-packages/PyQt4/uic/widget-plugins/qgis_customwidgets.py
>>>
>>/usr/lib/python2.7/dist-packages/PyQt4/uic/widget-plugins/qgis_customwidgets.pyc
>>> 
>>> 
>>> 
>>> Am I missing some magic somewhere? QtWebKitWidgets exists only from
>>Qt5.
>>> in Qt4 it should still be QtwebKit.
>>> 
>>> ciao
>>> Marco
>>> 
>>> 
>>> [0]
>>>
>>https://github.com/akbargumbira/qgis_resources_sharing/blob/master/resource_sharing/gui/ui/resource_sharing_dialog_base.ui#L598
>>> 
>>> 
>>> On 07.12.2016 22:58, Denis Rouzaud wrote:
>>>> Hi Matteo,
>>>> 
>>>> The file is not present simply because you did not install QGIS.
>>>> 
>>>> See here
>>https://github.com/qgis/QGIS/blob/master/python/CMakeLists.txt#L287
>>>> 
>>>> 
>>>> Having it documented somewhere would be nice:
>>>> 
>>>> * Approach when installing
>>>> 
>>>> * Without installing: were to put libqgis_customwidget and
>>>> qgis_customwidgets.py, how to run pyuic.
>>>> 
>>>> 
>>>> Cheers,
>>>> 
>>>> Denis
>>>> 
>>>> On 12/07/2016 10:41 AM, matteo wrote:
>>>>> Hold on.. I should have manage it..
>>>>> 
>>>>> I discovered that my machine was missing the file
>>>>> 
>>>>> qgis_customwidgets.py
>>>>> 
>>>>> in the folder
>>>>> 
>>>>> /usr/lib/python2.7/dist-packages/PyQt4/uic/widget-plugins/
>>>>> 
>>>>> 
>>>>> in another machine I found that file and I copied it in the right
>>folder
>>>>> (the above one) and now it seems working, that is the plugin with
>>the
>>>>> custom widget is now correctly loaded without any more issues..
>>>>> 
>>>>> So many thanks Denis for the assistance..
>>>>> 
>>>>> 
>>>>> My question is now.. why was that file missing in the folder?
>>>>> In the other machine I ran Ubuntu and I was used to compile QGIS
>>with
>>>>> debian rules.
>>>>> In this new machine I compile QGIS with make and run it directly
>>from
>>>>> the output folder (so QGIS has never been installed with
>repository
>>>>> packages and/or deb files, don't know if this could be related to
>>the
>>>>> problem)
>>>>> 
>>>>> I have some confusion on my mind..
>>>>> 
>>>>> If this is worth I can put this solution (if you think it is a
>>solution
>>>>> and not a workaround) somewhere in the website or another place so
>>that
>>>>> other people facing the same problem could solve the issue.
>>>>> 
>>>>> Many many thanks to all
>>>>> 
>>>>> Matteo
>>>> 
>>>> 
>>>> 
>>>> _______________________________________________
>>>> Qgis-developer mailing list
>>>> Qgis-developer at lists.osgeo.org
>>>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>> 
>>> 
>>> -- 
>>> Marco Bernasocchi
>>> OPENGIS.ch - berna.io - 27summits.ch
>>> 
>
>-- 
>Marco Bernasocchi (mobile).
>OPENGIS.ch - berna.io - 27summits.ch
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Qgis-developer mailing list
>Qgis-developer at lists.osgeo.org
>List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
>Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

-- 
Marco Bernasocchi (mobile).
OPENGIS.ch - berna.io - 27summits.ch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20161208/89f249ba/attachment.html>


More information about the Qgis-developer mailing list