mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
added interface for positioning menu items from plugins
git-svn-id: http://svn.osgeo.org/qgis/trunk@711 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
2124bf5a0f
commit
f46cdf38c1
@ -1 +1 @@
|
|||||||
SUBDIRS = example maplayer spit geoprocessing
|
SUBDIRS = spit geoprocessing
|
||||||
|
@ -99,7 +99,8 @@ void QgsPgGeoprocessing::initGui()
|
|||||||
|
|
||||||
menu = ((QMainWindow *) qgisMainWindow)->menuBar();
|
menu = ((QMainWindow *) qgisMainWindow)->menuBar();
|
||||||
|
|
||||||
menuId = menu->insertItem("&Geoprocessing", pluginMenu);
|
// menuId = menu->insertItem("&Geoprocessing", pluginMenu);
|
||||||
|
menuId = qI->addMenu("&Geoprocessing", pluginMenu);
|
||||||
// Create the action for tool
|
// Create the action for tool
|
||||||
QAction *bufferAction = new QAction("Buffer features", QIconSet(icon_buffer), "&Buffer",
|
QAction *bufferAction = new QAction("Buffer features", QIconSet(icon_buffer), "&Buffer",
|
||||||
0, this, "buffer");
|
0, this, "buffer");
|
||||||
@ -251,7 +252,7 @@ void QgsPgGeoprocessing::buffer()
|
|||||||
// add the geometry column
|
// add the geometry column
|
||||||
//<db_name>, <table_name>, <column_name>, <srid>, <type>, <dimension>
|
//<db_name>, <table_name>, <column_name>, <srid>, <type>, <dimension>
|
||||||
sql = QString("select addgeometrycolumn('%1','%2','%3',%4,'%5',%6)")
|
sql = QString("select addgeometrycolumn('%1','%2','%3',%4,'%5',%6)")
|
||||||
.arg(dbname)
|
.arg(bb->schema())
|
||||||
.arg(bb->bufferLayerName())
|
.arg(bb->bufferLayerName())
|
||||||
.arg(bb->geometryColumn())
|
.arg(bb->geometryColumn())
|
||||||
.arg(bb->srid())
|
.arg(bb->srid())
|
||||||
|
@ -92,7 +92,8 @@ void QgsSpitPlugin::initGui()
|
|||||||
|
|
||||||
menu = ((QMainWindow *) qgisMainWindow)->menuBar();
|
menu = ((QMainWindow *) qgisMainWindow)->menuBar();
|
||||||
|
|
||||||
menuId = menu->insertItem("&Spit", pluginMenu);
|
//menuId = menu->insertItem("&Spit", pluginMenu);
|
||||||
|
menuId = qI->addMenu("&Spit", pluginMenu);
|
||||||
// Create the action for tool
|
// Create the action for tool
|
||||||
QAction *spitAction = new QAction("Import Shapefiles to PostgreSQL", QIconSet(icon_spit), "&SPIT",
|
QAction *spitAction = new QAction("Import Shapefiles to PostgreSQL", QIconSet(icon_spit), "&SPIT",
|
||||||
0, this, "spit");
|
0, this, "spit");
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <qstring.h>
|
#include <qstring.h>
|
||||||
|
#include <qmenubar.h>
|
||||||
#include "qgisinterface.h"
|
#include "qgisinterface.h"
|
||||||
#include "qgisapp.h"
|
#include "qgisapp.h"
|
||||||
#include "qgsmaplayer.h"
|
#include "qgsmaplayer.h"
|
||||||
@ -35,3 +36,11 @@ QString QgisIface::activeLayerSource(){
|
|||||||
return qgis->activeLayerSource();
|
return qgis->activeLayerSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int QgisIface::addMenu(QString menuText, QPopupMenu *menu){
|
||||||
|
QMenuBar *mainMenu = qgis->menuBar();
|
||||||
|
// get the index of the help menu
|
||||||
|
#ifdef DEBUG
|
||||||
|
std::cout << "Menu item count is : " << mainMenu->count() << std::endl;
|
||||||
|
#endif
|
||||||
|
return mainMenu->insertItem(menuText, menu,-1, mainMenu->count() -1);
|
||||||
|
}
|
||||||
|
@ -31,6 +31,8 @@ class QgisIface : public QgisInterface{
|
|||||||
QgsMapLayer *activeLayer();
|
QgsMapLayer *activeLayer();
|
||||||
//! Get source of the active layer
|
//! Get source of the active layer
|
||||||
QString activeLayerSource();
|
QString activeLayerSource();
|
||||||
|
//! Add a menu to the main menu bar of the application, positioned to the left of Help
|
||||||
|
int addMenu(QString menuText, QPopupMenu *menu);
|
||||||
//! Get an integer from the QgisApp object. This is a test function with no real utility
|
//! Get an integer from the QgisApp object. This is a test function with no real utility
|
||||||
int getInt();
|
int getInt();
|
||||||
private:
|
private:
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <qwidget.h>
|
#include <qwidget.h>
|
||||||
class QgisApp;
|
class QgisApp;
|
||||||
class QgsMapLayer;
|
class QgsMapLayer;
|
||||||
|
class QPopupMenu;
|
||||||
|
|
||||||
// interface class for plugins
|
// interface class for plugins
|
||||||
class QgisInterface : public QWidget{
|
class QgisInterface : public QWidget{
|
||||||
@ -23,6 +24,8 @@ public:
|
|||||||
virtual void addVectorLayer(QString vectorLayerPath, QString baseName, QString providerKey)=0;
|
virtual void addVectorLayer(QString vectorLayerPath, QString baseName, QString providerKey)=0;
|
||||||
//! Get pointer to the active layer (layer selected in the legend)
|
//! Get pointer to the active layer (layer selected in the legend)
|
||||||
virtual QgsMapLayer *activeLayer()=0;
|
virtual QgsMapLayer *activeLayer()=0;
|
||||||
|
//! add a menu item to the main menu, postioned to the left of the Help menu
|
||||||
|
virtual int addMenu(QString menuText, QPopupMenu *menu) =0;
|
||||||
private:
|
private:
|
||||||
//QgisApp *qgis;
|
//QgisApp *qgis;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user