<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi</p>
<p>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.</p>
<p>Sandro<br>
</p>
<div class="moz-cite-prefix">On 20.01.22 17:00, Xavier Moch (AFPG)
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:B24E8C59-594B-496C-B0BD-8E6749AC0638@afpg.asso.fr">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Hello !
<div class=""><br class="">
</div>
<div class="">Thanks to some answers on my previous question, I
realized that I missed something on using plugins in qwc2.<br
class="">
</div>
<div class=""><br class="">
</div>
<div class=""> * In the file config.json, it is possible to add a
new button in the topbar with following code : <i class="">{"key":
"Print", "icon": "layers"},</i></div>
<div class="">Now, a new button appears with a new icon. It works
exactly as the « Print » button.</div>
<div class=""><br class="">
</div>
<div class=""> * I specify now a new name, replacing the above
code by : <i class="">{"key": "Test", "icon": "layers"},</i></div>
<div class="">I still get the new button, but it does not have any
effect even if I duplicate the file <i class="">qwc2/plugins/Print.jsx</i>
under <i class="">qwc2/plugins/Test.jsx</i></div>
<div class="">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.</div>
<div class=""><br class="">
</div>
<div class="">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
?</div>
<div class=""><br class="">
</div>
<div class="">Many thanks,</div>
<div class="">Xavier</div>
<div class=""><br class="">
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
qgis-qwc2 mailing list
<a class="moz-txt-link-abbreviated" href="mailto:qgis-qwc2@lists.osgeo.org">qgis-qwc2@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-qwc2">https://lists.osgeo.org/mailman/listinfo/qgis-qwc2</a>
</pre>
</blockquote>
</body>
</html>