Results 1 to 5 of 5

Thread: strange error in connect()

  1. #1
    Join Date
    Apr 2006
    Posts
    122
    Thanks
    18
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default strange error in connect()

    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():
    Qt Code:
    1. void tcpCock::initGui()
    2. {
    3.  
    4. // Create the action for tool
    5. mQActionPointer = new QAction(QIcon(":/tcpcock/tcpcock.png"),"track", this);
    6. // Set the what's this text
    7. mQActionPointer->setWhatsThis(tr("Replace this with a short description of the what the plugin does"));
    8. // Connect the action to the run
    9. connect(mQActionPointer, SIGNAL(activated()), this, SLOT(run()));
    10. // Add the toolbar
    11. mToolBarPointer = new QToolBar((QMainWindow *) mQGisApp, "tcpCock");
    12. mToolBarPointer->setLabel("track");
    13. // Add the to the toolbar
    14. mQGisIface->addToolBarIcon(mQActionPointer);
    15. mQGisIface->addPluginMenu("&tcpCock", mQActionPointer);
    16. connect(mQGisIface->getMapCanvas(),SIGNAL(renderComplete(QPainter *)),this, SLOT(savePainter(QPainter *)));//line no 105
    17. }
    To copy to clipboard, switch view to plain text mode 

    both QgsMapCanvas and tcpCock inherits QObject. * mQGisIface is a private member of tcpCock and
    Last edited by jacek; 21st June 2006 at 12:57. Reason: changed [ code ] to [ quote ] to allow wrapping of long lines

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default 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.

  3. #3
    Join Date
    Apr 2006
    Posts
    122
    Thanks
    18
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default 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:
    Qt Code:
    1. **************/
    2. #ifndef tcpCock_H
    3. #define tcpCock_H
    4.  
    5. //QT4 includes
    6. #include <QObject>
    7. #include <QPainter>
    8. #include <QtNetwork>
    9. #include <QtGui>
    10. //QGIS includes
    11. #include <qgisapp.h>
    12. #include "../qgisplugin.h"
    13.  
    14. //forward declarations
    15. class QToolBar;
    16.  
    17. /**
    18. * \class Plugin
    19. * \brief [name] plugin for QGIS
    20. * [description]
    21. */
    22. class tcpCock:public QObject , public QgisPlugin
    23. {
    24. Q_OBJECT;
    25. public:
    26. /**
    27.   * Constructor for a plugin. The QgisApp and QgisIface pointers are passed by
    28.   * QGIS when it attempts to instantiate the plugin.
    29.   * @param Pointer to the QgisApp object
    30.   * @param Pointer to the QgisIface object.
    31.   */
    32. tcpCock(QgisApp * theApplication, QgisIface * theInterface);
    33. //! Destructor
    34. virtual ~tcpCock();
    35.  
    36. public slots:
    37. //! init the gui
    38. virtual void initGui();
    39. //! Show the dialog box
    40. void run();
    41. //! unload the plugin
    42. void unload();
    43. //! show the help document
    44. void help();
    45. //!draw a raster layer in the qui
    46. void drawRasterLayer(QString);
    47. //! Add a vector layer given vectorLayerPath, baseName, providerKey ("ogr" or "postgres");
    48. void drawVectorLayer(QString,QString,QString);
    49.  
    50. private:
    51. int mPluginType;
    52. //! Pointer to our toolbar
    53. QToolBar *mToolBarPointer;
    54. //! Pionter to QGIS main application object
    55. QgisApp *mQGisApp;
    56. //! Pointer to the QGIS interface object
    57. QgisIface *mQGisIface;
    58. //!pointer to the qaction for this plugin
    59. QAction * mQActionPointer;
    60. int x,y;
    61. QTcpServer *tcpServer;
    62. QTcpSocket *tcpSocket;
    63. QPainter *savedPainter;
    64. public slots:
    65. void savePainter(QPainter *);
    66. void settingServer(bool);
    67. void dataAvailable();
    68. void activatingNewConnection();
    69. void render();
    70. signals:
    71. //void dataFound();
    72. void startRender();
    73. };
    74.  
    75. #endif //tcpCock_H
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Apr 2006
    Posts
    122
    Thanks
    18
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: strange error in connect()

    Also that has been the case i would have got problem with other connects also.

    Qt Code:
    1. void tcpCock::run()
    2. {
    3. tcpCockGui *myPluginGui=new tcpCockGui(mQGisApp, QgisGui::ModalDialogFlags);
    4. //listen for when the layer has been made so we can draw it
    5. connect(myPluginGui, SIGNAL(drawRasterLayer(QString)), this, SLOT(drawRasterLayer(QString)));
    6. connect(myPluginGui, SIGNAL(drawVectorLayer(QString,QString,QString)), this, SLOT(drawVectorLayer(QString,QString,QString)));
    7.  
    8. connect(myPluginGui,SIGNAL(isCheckBoxClicked(bool)),this,SLOT(settingServer(bool)));
    9. connect(this,SIGNAL(startRender()),this,SLOT(render()));
    10. myPluginGui->show();
    11. }
    12.  
    13. // Unload the plugin by cleaning up the GUI
    14. void tcpCock::unload()
    15. {
    16. // remove the GUI
    17. mQGisIface->removePluginMenu("&tcpCock",mQActionPointer);
    18. mQGisIface->removeToolBarIcon(mQActionPointer);
    19. delete mQActionPointer;
    20. }
    To copy to clipboard, switch view to plain text mode 
    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

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default 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.

Similar Threads

  1. strange connect
    By mickey in forum Newbie
    Replies: 11
    Last Post: 30th June 2006, 13:52
  2. connect to sql server
    By raphaelf in forum Qt Programming
    Replies: 15
    Last Post: 27th February 2006, 18:06
  3. connect
    By mickey in forum Newbie
    Replies: 1
    Last Post: 25th February 2006, 18:31
  4. [Qt 4.1] Strange behaviour with QTableView
    By fane in forum Qt Programming
    Replies: 1
    Last Post: 23rd January 2006, 06:17

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.