Results 1 to 13 of 13

Thread: emitting and catching signals

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: emitting and catching signals

    Quote Originally Posted by srohit24 View Post
    Qt Code:
    1. connect(classA_object,SIGNAL(receiving_finished()), classB_object, SLOT(write_data()));
    2. //This is present in the mainclass's constructor which has a instance of classB_object but no classA instance.
    To copy to clipboard, switch view to plain text mode 
    you say the "no classA instance." is present in mainclass so how are you able to connect..
    i am afraid that you need to give some more code... why not just provide a simple minimal compilable program reproducing the problem?

  2. #2
    Join Date
    Feb 2009
    Posts
    143
    Thanks
    8

    Default Re: emitting and catching signals

    Should i place the connect command in classB's constructor to connect the signals as classB has classA's instance?

    EDIT

    I placed the connect code in the classB's constructor.The app compiled successfully but i got this in qDebug


    Qt Code:
    1. connect(classA_object,SIGNAL(receiving_finished()), this, SLOT(write_data()));
    2.  
    3. QObject::connect: Cannot connect (null)::receiving_finished() to classB::write_data()
    To copy to clipboard, switch view to plain text mode 
    Last edited by srohit24; 4th August 2009 at 05:36.

  3. #3
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: emitting and catching signals

    classA_object is not created, i.e. classA_object == 0.
    EDIT: take a debugger in your hands and debug your programm step by step.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  4. #4
    Join Date
    Feb 2009
    Posts
    143
    Thanks
    8

    Default Re: emitting and catching signals

    ok. but I have created a class object and I am using it make a function call.

    how can that be null?

  5. #5
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: emitting and catching signals

    this message says another
    QObject::connect: Cannot connect (null)::receiving_finished() to classB::write_data()
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

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
  •  
Qt is a trademark of The Qt Company.