[QGIS-Developer] Browser: deleteLayer deprecated ?

Alessandro Pasotti apasotti at gmail.com
Tue Nov 10 00:31:16 PST 2020


On Mon, Nov 9, 2020 at 3:13 PM Richard Duivenvoorde <rdmailings at duif.net> wrote:
>
> Hi Devs,
>
> I'm trying to hack my way into the Oracle provider [0].
>
> One of the things that was broken, was to drag and drop and drop a file in the browser onto the Oracle node (in the browser).
> That is working now with me (a little better), BUT trying to delete that table I get crashes.
>
> Then I saw:
> https://github.com/qgis/QGIS/blob/master/src/providers/oracle/qgsoracledataitems.h#L110-L128
> which has a message: "deleteLayer deprecated"
>
> Could this be the cause of my crashes? There is something going wrong with the setting of the item-flags.
>
> I'm looking into the Postgres provider, and that one is NOT crashing.
> I do see that postgres has a QgsPostgresDataItemGuiProvider, which is not available in the oracle family...
>
> Anybody any pointers? Do we have to create/add a QgsOracleDataItemGuiProvider?
>
> Regards,
>
> Richard Duivenvoorde
>


Hi Richard,

one way to integrate a provider in the browser is to implement the
connections API:
https://qgis.org/api/classQgsAbstractDatabaseProviderConnection.html#details

When it's done, all the generic methods implemented in the browser
will automatically work, see

QgsDatabaseItemGuiProvider::populateContextMenu
QgsFieldsItemGuiProvider::populateContextMenu

For a sample implementation you could have a look to the PG provider.

You may need to subclass the GUI provider in case the base
functionality is not ok, the PG provider does that for some methods
too, so the answer is yes: you need to create a GUI provider for the
provider or you can choose to abstract out the PG provider and create
a base class if you see that there is a common ground for abstraction.

Hope this helps.


-- 
Alessandro Pasotti
QCooperative:  www.qcooperative.net
ItOpen:   www.itopen.it


More information about the QGIS-Developer mailing list