Connect up to projectRead signal...

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@2263 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
timlinux 2004-11-16 17:51:08 +00:00
parent 96d86666fa
commit 140d2993da
2 changed files with 14 additions and 3 deletions

View File

@ -104,10 +104,20 @@ void Plugin::initGui()
myQActionPointer = new QAction("Copyright Label", QIconSet(icon), "&Wmi",0, this, "run");
// Connect the action to the run
connect(myQActionPointer, SIGNAL(activated()), this, SLOT(run()));
// This calls the north arrow renderer everytime the cnavas has drawn itself
// This calls the renderer everytime the cnavas has drawn itself
connect(qGisInterface->getMapCanvas(), SIGNAL(renderComplete(QPainter *)), this, SLOT(renderLabel(QPainter *)));
//this resets this plugin up if a project is loaded
connect(qgisMainWindowPointer, SIGNAL(projectRead()), this, SLOT(projectRead()));
// Add the icon to the toolbar
qGisInterface->addToolBarIcon(myQActionPointer);
//initialise default values in the gui
projectRead();
}
void Plugin::projectRead()
{
std::cout << "Copyright plugin - project read slot called...." << std::endl;
//default text to start with - try to fetch it from qgsproject
QgsProject::Properties myProperties = QgsProject::instance()->properties("CopyrightLabel");
for ( QgsProject::Properties::const_iterator i = myProperties.begin();
@ -147,7 +157,6 @@ void Plugin::initGui()
mLabelQColor = QColor(Qt::black);
refreshCanvas();
}
//method defined in interface
void Plugin::help()

View File

@ -45,7 +45,9 @@ class Plugin:public QObject, public QgisPlugin
virtual ~ Plugin();
public slots:
//! init the gui
virtual void initGui();
void initGui();
//!set values on the gui when a project is read or the gui first loaded
void projectRead();
//! Show the dialog box
void run();
void renderLabel(QPainter *);