Skip to content
Browse files
Update plugin template for the new way of adding a plugin to the qgis…
… menus

git-svn-id: c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed May 19, 2006
1 parent 14d1e4e commit 862a654a890c1930cb25c34e75fedf1ab3363dc9
Showing with 4 additions and 9 deletions.
  1. +4 −7 src/plugins/plugin_template/plugin.cpp
  2. +0 −2 src/plugins/plugin_template/plugin.h
@@ -89,22 +89,19 @@ static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI;
void [pluginname]::initGui()
// we create a single menu entry for this plugin - though you can easily add more here if you need to
QMenu *pluginMenu = mQGisIface->getPluginMenu("&[menuname]");
//set the icon from the resource file
mMenuId = pluginMenu->insertItem(QIcon(":/[pluginlcasename]/[pluginlcasename].png"),"&[menuitemname]", this, SLOT(run()));
//create a tooltip for the menu entry
pluginMenu->setWhatsThis(mMenuId, tr("Replace this with a short description of the what the plugin does"));

// Create the action for tool
mQActionPointer = new QAction(QIcon(":/[pluginlcasename]/[pluginlcasename].png"),"[menuitemname]", this);
// Set the what's this text
mQActionPointer->setWhatsThis(tr("Replace this with a short description of the what the plugin does"));
// Connect the action to the run
connect(mQActionPointer, SIGNAL(activated()), this, SLOT(run()));
// Add the toolbar
mToolBarPointer = new QToolBar((QMainWindow *) mQGisApp, "[menuname]");
// Add the to the toolbar
mQGisIface->addPluginMenu("&[menuname]", mQActionPointer);

//method defined in interface
@@ -130,7 +127,7 @@ void [pluginname]::run()
void [pluginname]::unload()
// remove the GUI
delete mQActionPointer;
@@ -109,8 +109,6 @@ public slots:

int mPluginType;
//! Id of the plugin's menu. Used for unloading
int mMenuId;
//! Pointer to our toolbar
QToolBar *mToolBarPointer;
//! Pionter to QGIS main application object

0 comments on commit 862a654

Please sign in to comment.