Results 1 to 3 of 3

Thread: the strange phenomenon: the emiited signal cannot be received by the slot function

  1. #1
    Join Date
    Nov 2014
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default the strange phenomenon: the emiited signal cannot be received by the slot function

    file1.cpp:
    Qt Code:
    1. connect(this, SIGNAL(newOrbCorrections(QList<t_orbCorr>)),
    2. BNC_CORE, SLOT(slotNewOrbCorrections(QList<t_orbCorr>)));
    3.  
    4. connect(this, SIGNAL(newCorrLine(QString, QString, bncTime)),
    5. BNC_CORE, SLOT(slotNewCorrLine(QString, QString, bncTime)));
    To copy to clipboard, switch view to plain text mode 


    file2.cpp:
    Qt Code:
    1. void t_bncCore::slotNewCorrLine(QString line, QString staID, bncTime coTime) {
    2.  
    3. QMutexLocker locker(&_mutex);
    4. ……………………………………
    5. }
    6.  
    7. void t_bncCore::slotNewOrbCorrections(QList<t_orbCorr> orbCorrections) {
    8. QMutexLocker locker(&_mutex);
    9. ……………………………………………………
    10. }
    To copy to clipboard, switch view to plain text mode 

    main.cpp
    Qt Code:
    1. {
    2. emit newCorrLine("ddd", _staID, _lastTime);
    3. emit newOrbCorrections(orbCorrections);
    4. }
    To copy to clipboard, switch view to plain text mode 

    the slot function slotNewCorrLine can be correctly called ,but the function slotNewOrbCorrections can not be called.
    I am very confusing about the phenomenon.
    Looking forward to your answer,Thank you very much.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: the strange phenomenon: the emiited signal cannot be received by the slot functio

    Do you get any warnings in the console during runtime? Do your sender and receiver live in the same thread?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Nov 2014
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: the strange phenomenon: the emiited signal cannot be received by the slot functio

    according to you suggestions,I find:
    1. the warnings : QObject::connect: Cannot queue arguments of type 'QList<t_orbCorr>'
    2. the sender and receiver are not in the same thread


    Added after 21 minutes:


    Quote Originally Posted by wysota View Post
    Do you get any warnings in the console during runtime? Do your sender and receiver live in the same thread?
    Thank you very much ,with your suggestions,I solve the problem by registering the type 'QList<t_orbCorr>'.
    Last edited by zhaolewen; 15th November 2014 at 14:06.

Similar Threads

  1. Replies: 2
    Last Post: 26th October 2013, 05:40
  2. SIGNAL/SLOT Calling the same function. Possible?
    By matthieunc in forum Qt Programming
    Replies: 4
    Last Post: 28th July 2011, 23:24
  3. why doesn't signal gets emiited?
    By naturalpsychic in forum Qt Programming
    Replies: 3
    Last Post: 26th January 2011, 22:43
  4. Replies: 4
    Last Post: 20th January 2011, 01:03
  5. QThread Signal Not Received By Main Thread Slot
    By EF2008 in forum Qt Programming
    Replies: 7
    Last Post: 4th June 2010, 08:06

Tags for this Thread

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.