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

2023-11-05 Thread Nyall Dawson via QGIS-Developer
On Mon, 6 Nov 2023, 6:32 am David Signer via QGIS-Developer, <
qgis-developer@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@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
>
___
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


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

2023-11-05 Thread David Signer via QGIS-Developer
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


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

2023-11-04 Thread Pankajeshwara Sharma via QGIS-Developer
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