qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.29k stars 2.96k forks source link

Python QgsRendererV2Widget not displaying on Windows 64 build #17377

Closed qgib closed 5 years ago

qgib commented 10 years ago

Author Name: Chris Crook (@ccrook) Original Redmine Issue: 8646 Affected QGIS version: 2.4.0 Redmine category:python_plugins


I maintain the VectorFieldRenderer widget, which implements a python custom renderer. The QGIS 2.0 version is working on Ubuntu, but on windows 64 (using standalone installer), when the renderer is selected in the Properties | Style dialog, the renderer configuration widget is not displayed, and instead there is just a message "This renderer doesn't implement a graphical interface".

I've build a minimal custom renderer (attached as LayerTest.zip), and that behaves in the same way, so I suspect that there is an issue in 64bit build (note - I haven't tested other windows builds).

Steps to replicate: 1) Install attached LayerTest plugin to /.qgis2/python/plugins 2) Start QGIS 3) Open plugin manager and enable LayerTest plugin 4) Create a new point vector layer 5) Make the new layer the current layer and open the Style tab of the layer Properties dialog 6) Select the LayerTest renderer type

The dialog box should show "Dummy widget for layer ".

It does this on ubuntu 12.04. On windows 64bit build it displays the error message above (This renderer doesn't implement a graphical interface).


qgib commented 10 years ago

Author Name: Anónimo (Anónimo)


Fixed in changeset "86ddc49acf3599e6d959f462da1d870dd6ba148d".


qgib commented 10 years ago

Author Name: Matthias Kuhn (@m-kuhn)


Hi, can somebody verify, if this really solves the issue and re-open if appropriate?

And thanks to @mbernasocchi for finding this solution.

qgib commented 10 years ago

Author Name: Chris Crook (@ccrook)


Subtle indeed - great work. ATM I don't have a windows build environment, so can't confirm. But, in anticipation of this resolving the issue, thanks!

qgib commented 10 years ago

Author Name: Andy Aschwanden (Andy Aschwanden)


Hi,

While I was trying to use the VectorFieldRenderer widget mentioned above, I've noticed that this issue still exists on QGIS 7c98970 (nightly build from http://qgis.dakotacarto.com/, Mac OS X 10.8.5). I've also tested the minimal example in TestLayer.zip, with the same result, it shows

"This renderer doesn't implement a graphical interface"

Thanks.


qgib commented 10 years ago

Author Name: Paolo Cavallini (@pcav)


qgib commented 10 years ago

Author Name: Chris Crook (@ccrook)


Still seems to be an issue in version 2.4 on Windows 64bit

qgib commented 10 years ago

Author Name: Chris Crook (@ccrook)


qgib commented 10 years ago

Author Name: Chris Crook (@ccrook)


I've just upgraded Ubuntu to version 14.04 and this issue is now present on Ubuntu as well. So it occurs in 64 bit environments generally - windows, ubuntu, mac. This occurs both in the released version and building from source. I assume that this is due to a new version of SIP with the Ubuntu version upgrade.


qgib commented 10 years ago

Author Name: Chris Crook (@ccrook)


The underlying issue relates to python subclasses of C++ classes. When the python object is saved in C++ code (eg in a registry), it loses the python bindings to methods that are over-ridden in the python class- they are not used when the object is called from C++, and instead the C++ base class implementations of the methods are used.

This means that python implementations of C++ base classes (renderers, custom layers, etc) will generally not work.

qgib commented 10 years ago

Author Name: Chris Crook (@ccrook)


qgib commented 10 years ago

Author Name: Jürgen Fischer (@jef-n)


Despite the @/Transfer/@ annotation on @QgsRendererV2Registry::addRenderer@ the @LayerMetadata@ instance is deleted. If the metadata is assigned to a member variable of @Plugin@ to avoid it's destruction the GUI page appears.

qgib commented 9 years ago

Author Name: Jürgen Fischer (@jef-n)


qgib commented 9 years ago

Author Name: Jürgen Fischer (@jef-n)


qgib commented 7 years ago

Author Name: Giovanni Manghi (@gioman)


qgib commented 5 years ago

Author Name: Giovanni Manghi (@gioman)


End of life notice: QGIS 2.18 LTR

Source: http://blog.qgis.org/2019/03/09/end-of-life-notice-qgis-2-18-ltr/