Results 1 to 11 of 11

Thread: I can not do a signal working

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    692
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default I can not do a signal working

    Hi I have a clas ( inherited from QObject ) containing a signal.
    When I try compile ( with visual studio 2008 ) I get the following error from the compiler:
    IrisKernel::sig_userRecognized': invalid call of member function non-static
    ( translated from Italian ).

    This is the class declaration:


    Qt Code:
    1. class IrisKernel : public QObject
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. IrisKernel(QObject *parent = 0);
    7. virtual ~IrisKernel();
    8.  
    9. static const QByteArray findMatchingPerson( KSBitVector&, double *mindist );
    10. static void onStoreIrisCodes(IplImage** imageList, QString& dni, bool storeImages);
    11.  
    12. signals:
    13. void sig_userRecognized(QByteArray&);
    14.  
    15. protected:
    16. private:
    17. int m_templateSize;
    18. bool m_validated;
    19. };
    To copy to clipboard, switch view to plain text mode 
    I don't get such error with other classes and the pro file is well edited.
    Which can be the error?
    Regards
    Franco Amato

  2. #2
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: I can not do a signal working

    The error is in your implementation, not your declaration. And the error message you posted tells you exactly what the problem is. Please review basic C++ rules on static members.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: I can not do a signal working

    Re-run qmake and then rebuild. Does the error persist?

    Edit: SixDegrees is on the money. I misread this as the usual "file has not been moc-ed" problem.

  4. #4
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: I can not do a signal working

    Is the error code C2352? Then how do you call (emit) the signal?
    Like this emit IrisKernel::sig_userRecognized(...);?
    Then lose the IrisKernel:: and call emit sig_userRecognized(...);

  5. #5
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    692
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: I can not do a signal working

    Quote Originally Posted by ChrisW67 View Post
    Re-run qmake and then rebuild. Does the error persist?

    Edit: SixDegrees is on the money. I misread this as the usual "file has not been moc-ed" problem.
    Quote Originally Posted by ChrisW67 View Post
    Re-run qmake and then rebuild. Does the error persist?
    Hi yes.
    I deleted all visual-studio related files, then I re-run qmake so:
    qmake -tp vc myfile.pro
    They I built the created solution and the error persist.
    Maybe I can not mix static functions and signals into the same class?
    Regards

    Quote Originally Posted by Zlatomir View Post
    Is the error code C2352? Then how do you call (emit) the signal?
    Like this emit IrisKernel::sig_userRecognized(...);?
    Then lose the IrisKernel:: and call emit sig_userRecognized(...);
    The error is this:
    error C2352: 'IrisKernel::sig_userRecognized': chiamata non valida di funzione membro non statica
    English translation: call not valid to a non-static function
    Franco Amato

  6. #6
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: I can not do a signal working

    I assumed you have an object, don't just try to emit the signal from a static method or try to create a "static" signal.

  7. The following user says thank you to Zlatomir for this useful post:

    franco.amato (4th February 2011)

Similar Threads

  1. QFutureWatcher finished() signal not working
    By DiamonDogX in forum Qt Programming
    Replies: 13
    Last Post: 25th October 2011, 18:27
  2. Signal and Slot connection not working !!
    By prakash437 in forum Qt Programming
    Replies: 3
    Last Post: 17th May 2010, 10:16
  3. QObject signal/slot not working
    By Msnforum in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2009, 22:50
  4. Signal Slot not working
    By munna in forum Qt Programming
    Replies: 8
    Last Post: 6th November 2006, 10:36
  5. QTreeWidget signal not working
    By Kapil in forum Newbie
    Replies: 6
    Last Post: 28th April 2006, 10:19

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.