Skip to content

Commit 7baf95f

Browse files
author
timlinux
committed
Implemented close and cancale sig/slot in default generated gui
Added detailed instructions for getting started with the new gnerataed plugin once it is build. Added some better comments to plugin.cpp git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5204 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 1e7d2c8 commit 7baf95f

File tree

2 files changed

+81
-107
lines changed

2 files changed

+81
-107
lines changed

src/plugins/plugin_template/plugin.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,16 @@ static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI;
8484
}
8585

8686
/*
87-
* Initialize the GUI interface for the plugin
87+
* Initialize the GUI interface for the plugin - this is only called once when the plugin is
88+
* added to the plugin registry in the QGIS application.
8889
*/
8990
void [pluginname]::initGui()
9091
{
92+
// we create a single menu entry for this plugin - though you can easily add more here if you need to
9193
QMenu *pluginMenu = mQGisIface->getPluginMenu("&[menuname]");
92-
//set teh icon from the resource file
94+
//set the icon from the resource file
9395
mMenuId = pluginMenu->insertItem(QIcon(":/[pluginlcasename]/[pluginlcasename].png"),"&[menuitemname]", this, SLOT(run()));
94-
96+
//create a tooltip for the menu entry
9597
pluginMenu->setWhatsThis(mMenuId, tr("Replace this with a short description of the what the plugin does"));
9698

9799
// Create the action for tool
@@ -111,7 +113,10 @@ void [pluginname]::help()
111113
//implement me!
112114
}
113115

114-
// Slot called when the buffer menu item is activated
116+
// Slot called when the menu item is activated
117+
// If you created more menu items / toolbar buttons in initiGui, you should
118+
// create a separate handler for each action - this single run() method will
119+
// not be enough
115120
void [pluginname]::run()
116121
{
117122
[pluginname]Gui *myPluginGui=new [pluginname]Gui(mQGisApp, QgisGui::ModalDialogFlags);

0 commit comments

Comments
 (0)