qgis / qwc2-demo-app

QWC2 demo application
Other
240 stars 149 forks source link

Open Legend when opening app #485

Closed Patatekes closed 8 months ago

Patatekes commented 8 months ago

Hello,

I've been trying for a while to automaticly open the MapLegend when my application starts. This would be nice, since i know most users are to stupid/lazy to open it.

Regards, Johannes

danceb commented 8 months ago

I missed this in a similar way, recently. I thought it would be nice, if the layer tree is opened automatically when a map theme is loaded. So the user can see directly which layers are loaded within the theme. Maybe there is a way to find a general solution for all plugins to open them while loading a theme explicitly or on startup of the whole application? Would be a nice feature!

benoitblanc commented 8 months ago

Hi,

You can set a parameter called startupTask in your config.json file.

For instance, you would like that the plugin LayerTree is shown when application starts.

...
"startupTask": {"key": "LayerTree"}
...

You should be able to do the same thing with one of the existing plugins (ThemeSwitcher, MapLegend, ...).

Documentation (https://qwc-services.github.io/configuration/ViewerConfiguration/#global-settings) says:

startupTask Task to automatically aktivate on application start, in the format {key: "", "mode": ""}.

It is effective for the whole application, I think it is not implemented for theme loading.

Regards

danceb commented 8 months ago

Even this issue is closed, I came around another thing regarding this: As the startupTask is a global configuration parameter, it is not possible at the moment to set these only for desktop or mobile view, right? The problem here is, that you want to have a tidy mobile interface if possible, and a plugin which covers the whole screen at startup isn't the best thing for that ... So the best thing would be, to get the change to set this only for desktop view ...

manisandro commented 8 months ago

I see two options: