PDA

View Full Version : Problem with connect



eekhoorn12
21st December 2010, 17:02
Hey all,

I have a problem using connect. Currently i am using the QXmpp (http://code.google.com/p/qxmpp/) library to make chat a program that can be used over the google network.

Now i am following there examples to create a basic application, specifically this example http://qxmpp.googlecode.com/svn/trunk/examples/GuiClient/ .

In there constructor they have this line of code:


check = connect(&m_xmppClient.rosterManager(),
SIGNAL(rosterChanged(const QString&)),
this, SLOT(rosterChanged(const QString&)));

Where m_xmppClient is:
QXmppClient m_xmppClient;

That should return this (http://qxmpp.googlecode.com/svn/doc/HEAD/html/classQXmppClient.html#a6a0bb409bad66a4f5ea91056ee1 90ad4).

But when i do this in my application:

connect(&chatClient.rosterManager(), SIGNAL(rosterReceived()), this, SLOT(rosterReceived()));

With chatClient being:

QXmppClient chatClient;

I get the following error:

../ChatApp/maindialog.cpp: In member function 'void mainDialog::createActions()':
../ChatApp/maindialog.cpp:56: error: no matching function for call to 'mainDialog::connect(QXmppRosterManager*, const char*, mainDialog* const, const char*)'
e:/Qt/2010.05/qt/include/QtCore/../../src/corelib/kernel/qobject.h:198: note: candidates are: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType)
e:/Qt/2010.05/qt/include/QtCore/../../src/corelib/kernel/qobject.h:313: note: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const

But i don't get this error on there example

Regards

Eekhoorn12

Phalanx
21st December 2010, 17:07
looks like Qt::ConnectionType missing where you call function mainDialog::connect(QXmppRosterManager*, const char*, mainDialog* const, const char*, right_here)

Lykurg
21st December 2010, 18:16
It has nothing to do with the 5th parameter. You are missing a header file which tells the compiler that QXmppRosterManager is a QObject. So try
#include "QXmppRosterManager.h"

eekhoorn12
21st December 2010, 20:48
Thanks that worked