@@ -89,22 +89,19 @@ static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI;
89
89
*/
90
90
void [pluginname]::initGui()
91
91
{
92
- // we create a single menu entry for this plugin - though you can easily add more here if you need to
93
- QMenu *pluginMenu = mQGisIface ->getPluginMenu (" &[menuname]" );
94
- // set the icon from the resource file
95
- mMenuId = pluginMenu->insertItem (QIcon (" :/[pluginlcasename]/[pluginlcasename].png" )," &[menuitemname]" , this , SLOT (run ()));
96
- // create a tooltip for the menu entry
97
- pluginMenu->setWhatsThis (mMenuId , tr (" Replace this with a short description of the what the plugin does" ));
98
92
99
93
// Create the action for tool
100
94
mQActionPointer = new QAction (QIcon (" :/[pluginlcasename]/[pluginlcasename].png" )," [menuitemname]" , this );
95
+ // Set the what's this text
96
+ mQActionPointer ->setWhatsThis (tr (" Replace this with a short description of the what the plugin does" ));
101
97
// Connect the action to the run
102
98
connect (mQActionPointer , SIGNAL (activated ()), this , SLOT (run ()));
103
99
// Add the toolbar
104
100
mToolBarPointer = new QToolBar ((QMainWindow *) mQGisApp , " [menuname]" );
105
101
mToolBarPointer ->setLabel (" [menuitemname]" );
106
102
// Add the to the toolbar
107
103
mQGisIface ->addToolBarIcon (mQActionPointer );
104
+ mQGisIface ->addPluginMenu (" &[menuname]" , mQActionPointer );
108
105
109
106
}
110
107
// method defined in interface
@@ -130,7 +127,7 @@ void [pluginname]::run()
130
127
void [pluginname]::unload()
131
128
{
132
129
// remove the GUI
133
- mQGisIface ->removePluginMenuItem (" &[menuname]" ,mMenuId );
130
+ mQGisIface ->removePluginMenu (" &[menuname]" ,mQActionPointer );
134
131
mQGisIface ->removeToolBarIcon (mQActionPointer );
135
132
delete mQActionPointer ;
136
133
}
0 commit comments