[Qgis-developer] question on Adding plugin to qgis

humarco marco.hugentobler at karto.baug.ethz.ch
Tue May 30 03:21:36 EDT 2006


Hi nitin,

Am Montag 29 Mai 2006 10:18 schrieb nitin quick:
> Hello Everybody,
> I am currently using qgis0.7.9 downloaded from svn installed on FC4.
> I need to add plugin to qgis which will display direction of wind.
> NorthArrow Plugin provides similar functionality. So i did make copy of
> that code put my Cock.png file path in place of north_arrow in a new folder
> named Cock in src/plugins/. I changed the code a bit ( north_arrow to Cock
> , just change of name). and addition in configure script similar o existing
> code. Now my questions are:
> i). Am i doing correect for adding a new plugin? Is it good way or there is
> scope of improvement which i think will be?
> ii) Is it required to compile Qgis fully to make my plugin functionable .
> Is there any way where i can only compile new plugin code and link it
> dynamiclly.

There is nothing wrong in creating new plugins by looking how existing ones 
work. If you also copied and adapted the auto* stuff of the NorthArrow 
plugin, then your plugin should be built together with qgis. But it is not 
required to compile the whole qgis for your plugin. You may just compile the 
sources of your plugin into a shared library without building qgis from 
source. All you need for it is the qt and qgis headers and of course you need 
to link the plugin to the qgis libraries (libgui, libraster, ...). 

> iii)For adding plugin menu to GUI we are using code ..
>
>     qGisInterface->addPluginMenu(tr("&Decoration"),myQActionPointer);
>   what does "&Decoration" signify here.

"Decoration" is the name of the menu entry (and Control-D the shortcut for it)

> Any suggestions on any study material or tutorial which will help me in
> designing plugin are welcome. I am currently reading  source code to do so.

On the qgis wiki, there are several articles about plugin programming:

http://wiki.qgis.org/qgiswiki/DevelopersCorner#head-3709e61959139ab8995e0542a9ad930c2d17090a

section 'Help on writing plugins'

Marco



More information about the Qgis-developer mailing list