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

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@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.sha...@auckland.ac.nz
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer@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@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to