[QGIS-Developer] Open plugin automatically when file is dragged onto QGIS

Nyall Dawson nyall.dawson at gmail.com
Sun Nov 5 13:15:44 PST 2023


On Mon, 6 Nov 2023, 6:32 am David Signer via QGIS-Developer, <
qgis-developer at lists.osgeo.org> wrote:

> You can use an eventfilter. You can find an example here
> https://github.com/opengisch/QgisModelBaker/blob/master/QgisModelBaker/qgismodelbaker.py#L507C7-L552
>

A better approach would be a QgsCustomDropHandler. See

https://api.qgis.org/api/3.28/classQgsCustomDropHandler.html

Nyall


>
> However, it may be appropriate to have a setting for this. In the plugin
> mentioned above, the user is asked if they want to open this type of file
> always with this plugin in the future.
>
> Cheers
> Dave
>
> On Sun, Nov 5, 2023 at 1:54 AM Pankajeshwara Sharma via QGIS-Developer <
> qgis-developer at lists.osgeo.org> wrote:
>
>> Hello all,
>>
>> I would like a feature within QGIS so that when files with ".xyz"
>> extension are dragged onto the application, would make my plugin to open
>> automatically.
>> This can prevent the user from having to go to the File menu and open the
>> file.
>>
>> This is similar to when shapefiles are dragged onto QGIS, and the
>> shapefiles are automatically loaded and displayed in QGIS.
>> Except, dragging a file with a ".xyz" extension should result in my
>> plugin (a dialog box from then plugin) to open.
>>
>> Is there a setting I can configure?
>>
>> Yours sincerely,
>> Pankaj Sharma
>> Research Fellow
>> University of Auckland
>> pankaj.sharma at auckland.ac.nz
>> _______________________________________________
>> QGIS-Developer mailing list
>> QGIS-Developer at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20231106/809a0782/attachment.htm>


More information about the QGIS-Developer mailing list