<div dir="ltr"><div>Hi Denis, all<br></div><div><br></div><div>I keep forgetting there are now also (totally cool) docs for the python API... I guess old habits die hard ;)</div><div><br></div><div>From your tip I guess the problem I'm facing is likely related to my class inheriting from the wrong base ( as I'm not using QgsOptionsPageWidget).</div><div><br></div><div>I'll try it out later and let you know ;)</div><div><br></div><div>As for the raster layer properties dialog , is this indeed not implemented there?<br></div><div><br></div><div>Best regards<br></div><div><br></div><div><br><div class="gmail_quote"><div dir="ltr">Denis Rouzaud <<a href="mailto:denis.rouzaud@gmail.com">denis.rouzaud@gmail.com</a>> escreveu no dia quinta, 18/10/2018 à(s) 01:49:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Ricardo,<div><br></div><div>For python, looking at the python API is always a good start ;)</div><div><a href="https://qgis.org/pyqgis/master/gui/other/QgisInterface.html#qgis.gui.QgisInterface.registerOptionsWidgetFactory" target="_blank">https://qgis.org/pyqgis/master/gui/other/QgisInterface.html#qgis.gui.QgisInterface.registerOptionsWidgetFactory</a></div><div><br></div><div>This means you must give a QgsOptionsWidgetFactory</div><div><a href="https://qgis.org/pyqgis/master/gui/Options/QgsOptionsWidgetFactory.html" target="_blank">https://qgis.org/pyqgis/master/gui/Options/QgsOptionsWidgetFactory.html</a></div><div><br></div><div>Here the docs could be clearer but this is the class you have to inherit.</div><div>You need to implement title, icon and createWidget. In the latter, you'll be able to load your UI and return the widget to be displayed. The widget you return must inherit QgsOptionsPageWidget.</div><div><br></div><div>I hope this helps!</div><div><br></div><div><br></div><div>Denis</div><div><br><div class="gmail_quote"><div dir="ltr">On Wed, 17 Oct 2018, 18:24 Ricardo Filipe Soares Garcia da, <<a href="mailto:ricardo.garcia.silva@gmail.com" target="_blank">ricardo.garcia.silva@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Hi all</div><div><br></div><div>The API docs for QgisInterface[1] mention the existence of a `registerMapLayerConfigWidgetFactory()` method which says in its documentation:</div><div><br></div><div>> Register a new tab in the vector layer properties dialog. </div><div><br></div><div>I've been trying to test this out and see if I can add a new panel to a layer's properties dialog via a Python plugin. So far I've had no luck. Couldn't find any other docs/samples online showing how to do this. Perhaps someone can help me out?</div><div><br></div><div>Here is what I have:</div><div><br></div><div>-  made a custom .ui file in Qt designer with a simple QWidget that only has a QLabel inside</div><div>-  implemented a class inheriting from both `qgis.gui.QgsMapLayerConfigWidget` and my ui file (after it is loaded with uic.loadUiType)</div><div>- implemented a class inheriting from `qgis.gui.QgsMapLayerConfigWidgetFactory`. This class implements all of the methods declared as *virtual* in the cpp API, including the `createWidget()`, which returns a new instance of my custom maplayerconfigwidget class<br></div><div>- in my plugin's `initGui()` method I'm calling `iface.registerMapLayerConfigWidgetFactory()` and pass along my custom factory</div><div><br></div><div>I guess this should be enough to have a minimum working prototype. However, this is what happens:</div><div><br></div><div>- When I load up a vector layer and then open it's properties dialog, QGIS just crashes with a core dumped message.<br></div><div>- When I load up a raster layer and then open it's properties dialog, nothing happens. I suspect this functionality is probably not even available for raster layers. Is this true?</div><div><br></div><div>Can someone provide some pointers or some existing reference on how this would work? Thanks in advance<br></div><div><br></div><div>[1] - <a href="https://qgis.org/api/classQgisInterface.html#a2c64949239a7717d181e34d6f2c47851" target="_blank">https://qgis.org/api/classQgisInterface.html#a2c64949239a7717d181e34d6f2c47851</a> <br></div></div></div><div dir="ltr"><div dir="ltr"><div><br>-- <br><div dir="ltr" class="m_2532882235017014113m_-2140421326083511896gmail_signature">___________________________ ___ __<br>Ricardo Garcia Silva</div></div></div></div>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a></blockquote></div></div>-- <br><div dir="ltr" class="m_2532882235017014113gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">





<p class="m_2532882235017014113inbox-inbox-inbox-inbox-p1"><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:10pt">Denis Rouzaud</span><br style="color:rgb(0,0,0);font-family:Times;font-size:medium"><a href="mailto:denis@opengis.ch" style="font-family:Times;font-size:medium" target="_blank"><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:8pt">denis@opengis.ch</span> </a><br style="color:rgb(0,0,0);font-family:Times;font-size:medium"><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:8pt"><a>+41 76 370 21 22</a></span></p><p class="m_2532882235017014113inbox-inbox-inbox-inbox-p1"><span style="color:rgb(0,0,0);font-family:Verdana,sans-serif;font-size:8pt"><a><br></a></span></p></div></div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">___________________________ ___ __<br>Ricardo Garcia Silva</div></div></div>