Results 1 to 4 of 4

Thread: Problem with connect

  1. #1
    Join Date
    Jun 2007
    Location
    Netherlands
    Posts
    54
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Problem with connect

    Hey all,

    I have a problem using connect. Currently i am using the 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/trun...les/GuiClient/ .

    In there constructor they have this line of code:

    Qt Code:
    1. check = connect(&m_xmppClient.rosterManager(),
    2. SIGNAL(rosterChanged(const QString&)),
    3. this, SLOT(rosterChanged(const QString&)));
    To copy to clipboard, switch view to plain text mode 

    Where m_xmppClient is:
    Qt Code:
    1. QXmppClient m_xmppClient;
    To copy to clipboard, switch view to plain text mode 

    That should return this.

    But when i do this in my application:
    Qt Code:
    1. connect(&chatClient.rosterManager(), SIGNAL(rosterReceived()), this, SLOT(rosterReceived()));
    To copy to clipboard, switch view to plain text mode 

    With chatClient being:
    Qt Code:
    1. QXmppClient chatClient;
    To copy to clipboard, switch view to plain text mode 

    I get the following error:
    Qt Code:
    1. ../ChatApp/maindialog.cpp: In member function 'void mainDialog::createActions()':
    2. ../ChatApp/maindialog.cpp:56: error: no matching function for call to 'mainDialog::connect(QXmppRosterManager*, const char*, mainDialog* const, const char*)'
    3. 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)
    4. 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
    To copy to clipboard, switch view to plain text mode 

    But i don't get this error on there example

    Regards

    Eekhoorn12

  2. #2
    Join Date
    Apr 2010
    Posts
    21
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with connect

    looks like Qt::ConnectionType missing where you call function mainDialog::connect(QXmppRosterManager*, const char*, mainDialog* const, const char*, right_here)

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Problem with connect

    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
    Qt Code:
    1. #include "QXmppRosterManager.h"
    To copy to clipboard, switch view to plain text mode 

  4. The following user says thank you to Lykurg for this useful post:

    eekhoorn12 (21st December 2010)

  5. #4
    Join Date
    Jun 2007
    Location
    Netherlands
    Posts
    54
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem with connect

    Thanks that worked

Similar Threads

  1. connect() problem
    By harmodrew in forum Newbie
    Replies: 14
    Last Post: 5th August 2010, 17:45
  2. Object::Connect problem
    By geleven in forum Qt Programming
    Replies: 3
    Last Post: 6th April 2010, 02:38
  3. Connect Problem
    By nrabara in forum Newbie
    Replies: 3
    Last Post: 4th May 2009, 12:19
  4. connect problem
    By liengen in forum Newbie
    Replies: 2
    Last Post: 22nd October 2008, 16:21
  5. Problem with connect()
    By mrnor3 in forum Qt Programming
    Replies: 3
    Last Post: 23rd July 2008, 14:05

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.