strange error in connect()
Quote:
bqgis_plugin_tcpcock_la-tcpcock.Tpo -c tcpcock.cpp -fPIC -DPIC -o .libs/libqgis_plugin_tcpcock_la-tcpcock.o
tcpcock.cpp: In member function 'virtual void tcpCock::initGui()':
tcpcock.cpp:105: error: no matching function for call to 'tcpCock::connect(QgsMapCanvas*, const char [28], tcpCock* const, const char [25])'
/usr/local/Trolltech/Qt-4.1.2//include/QtCore/qobject.h:174: note: candidates are: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType)
/usr/local/Trolltech/Qt-4.1.2//include/QtCore/qobject.h:274: note: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const
make[5]: *** [libqgis_plugin_tcpcock_la-tcpcock.lo] Error 1
make[5]: Leaving directory `/home1/qgis/src/plugins/tcpCock'
make[4]: *** [all] Error 2
make[4]: Leaving directory `/home1/qgis/src/plugins/tcpCock'
code of initGui():
Code:
void tcpCock::initGui()
{
// Create the action for tool
mQActionPointer
= new QAction(QIcon(":/tcpcock/tcpcock.png"),
"track",
this);
// Set the what's this text
mQActionPointer->setWhatsThis(tr("Replace this with a short description of the what the plugin does"));
// Connect the action to the run
connect(mQActionPointer, SIGNAL(activated()), this, SLOT(run()));
// Add the toolbar
mToolBarPointer->setLabel("track");
// Add the to the toolbar
mQGisIface->addToolBarIcon(mQActionPointer);
mQGisIface->addPluginMenu("&tcpCock", mQActionPointer);
connect(mQGisIface
->getMapCanvas
(),
SIGNAL(renderComplete
(QPainter *)),
this,
SLOT(savePainter
(QPainter *)));
//line no 105 }
both QgsMapCanvas and tcpCock inherits QObject. * mQGisIface is a private member of tcpCock and
Re: strange error in connect()
When inheriting QObject, you must do so publically and QObject must appear first in the list if you use multiple inheritance, e.g. class Foo : public QObject, ... {};
The error message does indicate that they do not inherit QObject, but it could be a missing "public" too.
Re: strange error in connect()
ya i have taken care of that and i have inherited QObject publically first than anyother class.
declaration code is:
Code:
**************/
#ifndef tcpCock_H
#define tcpCock_H
//QT4 includes
#include <QObject>
#include <QPainter>
#include <QtNetwork>
#include <QtGui>
//QGIS includes
#include <qgisapp.h>
#include "../qgisplugin.h"
//forward declarations
/**
* \class Plugin
* \brief [name] plugin for QGIS
* [description]
*/
class tcpCock
:public QObject ,
public QgisPlugin
{
Q_OBJECT;
public:
/**
* Constructor for a plugin. The QgisApp and QgisIface pointers are passed by
* QGIS when it attempts to instantiate the plugin.
* @param Pointer to the QgisApp object
* @param Pointer to the QgisIface object.
*/
tcpCock(QgisApp * theApplication, QgisIface * theInterface);
//! Destructor
virtual ~tcpCock();
public slots:
//! init the gui
virtual void initGui();
//! Show the dialog box
void run();
//! unload the plugin
void unload();
//! show the help document
void help();
//!draw a raster layer in the qui
//! Add a vector layer given vectorLayerPath, baseName, providerKey ("ogr" or "postgres");
private:
int mPluginType;
//! Pointer to our toolbar
//! Pionter to QGIS main application object
QgisApp *mQGisApp;
//! Pointer to the QGIS interface object
QgisIface *mQGisIface;
//!pointer to the qaction for this plugin
int x,y;
public slots:
void settingServer(bool);
void dataAvailable();
void activatingNewConnection();
void render();
signals:
//void dataFound();
void startRender();
};
#endif //tcpCock_H
Re: strange error in connect()
Also that has been the case i would have got problem with other connects also.
Code:
void tcpCock::run()
{
tcpCockGui *myPluginGui=new tcpCockGui(mQGisApp, QgisGui::ModalDialogFlags);
//listen for when the layer has been made so we can draw it
connect(myPluginGui,
SIGNAL(drawRasterLayer
(QString)),
this,
SLOT(drawRasterLayer
(QString)));
connect(myPluginGui,SIGNAL(isCheckBoxClicked(bool)),this,SLOT(settingServer(bool)));
connect(this,SIGNAL(startRender()),this,SLOT(render()));
myPluginGui->show();
}
// Unload the plugin by cleaning up the GUI
void tcpCock::unload()
{
// remove the GUI
mQGisIface->removePluginMenu("&tcpCock",mQActionPointer);
mQGisIface->removeToolBarIcon(mQActionPointer);
delete mQActionPointer;
}
This code is also part of same file, but no problem are reported for connect in this slot.
I have very similar code aprt of same package giving no troubles. I don't know how to move forward in it. Please help
Re: strange error in connect()
Quote:
Originally Posted by quickNitin
tcpcock.cpp:105: error: no matching function for call to 'tcpCock::connect(QgsMapCanvas*, const char [28], tcpCock* const, const char [25])'
Make sure you have proper #include directive for QgsMapCanvas in that file.