Results 1 to 6 of 6

Thread: Calling a method from a non-member method

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2011
    Posts
    23
    Thanks
    6
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Calling a method from a non-member method

    Hi, I need to call a method from a non-member function. Is there a way to reach an object from the outside? (i'm sorry that i can't find the right way to express my question, but please bear with me...) I'm loking for something like
    Appname->object.processMessage()
    but I can't find a way to do it.
    This is a stub of my class implementation.
    I'm working with a subclass of QThread and HLP_Init comes from an external library. I tried to pass the method directly to the HLP Init, but that did not work because the compiler complained that the type of function was not right.

    Qt Code:
    1. void HLPReceiveMessage(tyHLP_Message message, tyHLP_LinkID linkId)
    2. {
    3. //i need to call void HLP_LinkManager::processMessage() here
    4. }
    5.  
    6. void HLPReceiveError(tyHLP_Error err, tyHLP_LinkID linkId)
    7. {
    8. }
    9.  
    10. void HLP_LinkManager::run()
    11. {
    12. int rc;
    13. //HLP server initialization
    14. rc=HLP_Init(HLP_LINK_SERVER,HLPReceiveMessage,HLPReceiveError);
    15. }
    16.  
    17. void HLP_LinkManager::processMessage()
    18. {
    19. //do stuff here
    20. }
    To copy to clipboard, switch view to plain text mode 

    And thanks in advance!
    Last edited by AndresBarbaRoja; 17th March 2011 at 16:31.

Similar Threads

  1. Calling a method to a parent window/widget
    By johnnyturbo3 in forum Newbie
    Replies: 4
    Last Post: 6th November 2010, 15:52
  2. error calling method using connect
    By jeffmetal in forum Newbie
    Replies: 4
    Last Post: 22nd April 2010, 18:09
  3. Replies: 1
    Last Post: 30th March 2009, 16:07
  4. Calling same method from separate threads
    By steg90 in forum Qt Programming
    Replies: 2
    Last Post: 19th July 2007, 08:55
  5. Replies: 4
    Last Post: 10th March 2007, 18:01

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.