1
1
/* **************************************************************************
2
- plugin.cpp
3
- Import tool for various worldmap analysis output files
4
- Functions:
2
+ [pluginlcasename].cpp
3
+ [plugindescription]
5
4
6
- -------------------
7
- begin : Jan 21, 2004
8
- copyright : (C) 2004 by Tim Sutton
9
- email : tim@linfiniti.com
5
+ -------------------
6
+ begin : [PluginDate]
7
+ copyright : [ (C) Your Name and Date]
8
+ email : [Your Email]
10
9
11
- ***************************************************************************/
12
-
13
- /* **************************************************************************
10
+ ***************************************************************************
14
11
* *
15
12
* This program is free software; you can redistribute it and/or modify *
16
13
* it under the terms of the GNU General Public License as published by *
@@ -20,30 +17,35 @@ email : tim@linfiniti.com
20
17
***************************************************************************/
21
18
/* $Id$ */
22
19
23
- // includes
20
+ //
21
+ // QGIS Specific includes
22
+ //
24
23
25
24
#include < qgisapp.h>
25
+ #include < qgisgui.h>
26
26
#include < qgsmaplayer.h>
27
27
#include < qgsrasterlayer.h>
28
28
#include " [pluginlcasename].h"
29
+ // the gui subclass
30
+ #include " [pluginlcasename]gui.h"
29
31
32
+ //
33
+ // Qt4 Related Includes
34
+ //
30
35
31
- #include < q3toolbar.h >
32
- #include < qmenubar.h >
33
- #include < qmessagebox.h >
34
- #include < q3popupmenu.h >
35
- #include < qlineedit.h >
36
- #include < qaction.h >
37
- #include < qapplication.h >
38
- #include < qcursor.h >
36
+ #include < QToolBar >
37
+ #include < QMenuBar >
38
+ #include < QMessageBox >
39
+ #include < QMenu >
40
+ #include < QLineEdit >
41
+ #include < QAction >
42
+ #include < QApplication >
43
+ #include < QCursor >
39
44
40
45
// non qt includes
41
46
#include < iostream>
42
47
43
- // the gui subclass
44
- #include " [pluginlcasename]gui.h"
45
48
46
- // xpm for creating the toolbar icon
47
49
#ifdef WIN32
48
50
#define QGISEXTERN extern " C" __declspec( dllexport )
49
51
#else
@@ -70,9 +72,9 @@ static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI;
70
72
*/
71
73
[pluginname]::[pluginname](QgisApp * theQGisApp,
72
74
QgisIface * theQgisInterface):
75
+ QgisPlugin (sName ,sDescription ,sPluginVersion ,sPluginType ),
73
76
mQGisApp(theQGisApp),
74
- mQGisIface(theQgisInterface),
75
- QgisPlugin(sName ,sDescription ,sPluginVersion ,sPluginType )
77
+ mQGisIface(theQgisInterface)
76
78
{
77
79
}
78
80
@@ -86,18 +88,18 @@ static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI;
86
88
*/
87
89
void [pluginname]::initGui()
88
90
{
89
- Q3PopupMenu *pluginMenu = qGisInterface ->getPluginMenu (" &[menuname]" );
91
+ QMenu *pluginMenu = mQGisIface ->getPluginMenu (" &[menuname]" );
90
92
// set teh icon from the resource file
91
- menuId = pluginMenu->insertItem (QIcon (" :/[pluginlcasename]/[pluginlcasename].png" )," &[menuitemname]" , this , SLOT (run ()));
93
+ mMenuId = pluginMenu->insertItem (QIcon (" :/[pluginlcasename]/[pluginlcasename].png" )," &[menuitemname]" , this , SLOT (run ()));
92
94
93
- pluginMenu->setWhatsThis (menuId , tr (" Replace this with a short description of the what the plugin does" ));
95
+ pluginMenu->setWhatsThis (mMenuId , tr (" Replace this with a short description of the what the plugin does" ));
94
96
95
97
// Create the action for tool
96
- mQActionPointer = new QAction (" [menuitemname] " , QIcon (icon), " &icon " , 0 , this , " run " );
98
+ mQActionPointer = new QAction (QIcon ( " :/[pluginlcasename]/[pluginlcasename].png " ), " [menuitemname] " , this );
97
99
// Connect the action to the run
98
100
connect (mQActionPointer , SIGNAL (activated ()), this , SLOT (run ()));
99
101
// Add the toolbar
100
- mToolBarPointer = new Q3ToolBar ((Q3MainWindow *) mQGisApp , " [menuname]" );
102
+ mToolBarPointer = new QToolBar ((QMainWindow *) mQGisApp , " [menuname]" );
101
103
mToolBarPointer ->setLabel (" [menuitemname]" );
102
104
// Add the to the toolbar
103
105
mQGisIface ->addToolBarIcon (mQActionPointer );
@@ -112,7 +114,7 @@ void [pluginname]::help()
112
114
// Slot called when the buffer menu item is activated
113
115
void [pluginname]::run()
114
116
{
115
- [pluginname]Gui *myPluginGui=new [pluginname]Gui (mQGisApp ," [menuitemname] " , true , 0 );
117
+ [pluginname]Gui *myPluginGui=new [pluginname]Gui (mQGisApp , QgisGui::ModalDialogFlags );
116
118
// listen for when the layer has been made so we can draw it
117
119
connect (myPluginGui, SIGNAL (drawRasterLayer (QString)), this , SLOT (drawRasterLayer (QString)));
118
120
connect (myPluginGui, SIGNAL (drawVectorLayer (QString,QString,QString)), this , SLOT (drawVectorLayer (QString,QString,QString)));
@@ -123,7 +125,7 @@ void [pluginname]::run()
123
125
void [pluginname]::unload()
124
126
{
125
127
// remove the GUI
126
- mQGisIface ->removePluginMenuItem (" &[menuname]" ,menuId );
128
+ mQGisIface ->removePluginMenuItem (" &[menuname]" ,mMenuId );
127
129
mQGisIface ->removeToolBarIcon (mQActionPointer );
128
130
delete mQActionPointer ;
129
131
}
0 commit comments