[qgis-qwc2] Help on how to use plugins in qwc2
Sandro Mani
manisandro at gmail.com
Thu Jan 20 08:31:52 PST 2022
Hi
If you run your viewer with debug=true as query parameter, you'll see
that clicking on such a TopBar button will emit a setCurrentTask action
with the key you specify as task. In your plugin, you'll need to look at
the application state to check whether the current task matches the one
of your plugin, and if so, react accordingly (i.e. by rendering the
component, etc). Look at the existing plugins for the various examples
where state.task.id is read.
Sandro
On 20.01.22 17:00, Xavier Moch (AFPG) wrote:
> Hello !
>
> Thanks to some answers on my previous question, I realized that I
> missed something on using plugins in qwc2.
>
> * In the file config.json, it is possible to add a new button in the
> topbar with following code : /{"key": "Print", "icon": "layers"},/
> Now, a new button appears with a new icon. It works exactly as the
> « Print » button.
>
> * I specify now a new name, replacing the above code by : /{"key":
> "Test", "icon": "layers"},/
> I still get the new button, but it does not have any effect even if I
> duplicate the file /qwc2/plugins/Print.jsx/ under /qwc2/plugins/Test.jsx/
> I tried to specify this new plugin in config.json and js/appConfig.js,
> but it still does not work. Since I do not exactly know how to do it,
> it is quite sure that I did not do it that well.
>
> Do you know where I can find a tutorial showing step by step how to
> add a new plugin, or can anyone explain it to me ?
>
> Many thanks,
> Xavier
>
>
> _______________________________________________
> qgis-qwc2 mailing list
> qgis-qwc2 at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/qgis-qwc2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-qwc2/attachments/20220120/236b716b/attachment.html>
More information about the qgis-qwc2
mailing list