Results 1 to 3 of 3

Thread: using function pointers and callback functions

  1. #1
    Join Date
    Sep 2012
    Posts
    31
    Thanks
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default using function pointers and callback functions

    Hi could anyone give me a simple reference to function pointers and callback functions in qt?

    are signal slots and callback functions different from each other?

    thanks!

  2. #2
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: using function pointers and callback functions

    Signal slots are different from function pointers in the way it has been implemented. Although the purpose of both of 'em is the same.
    Signal slots are easier to understand and implement. If you are largely using qt classes, it proves very helpful. However, it is slower than the function pointers as there are a few extra function calls.
    The speed however is immaterial in most of the cases because the percentage gain of using function pointers in most cases is not significant.

  3. The following user says thank you to pkj for this useful post:

    ehnuh (7th November 2012)

  4. #3
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: using function pointers and callback functions

    are signal slots and callback functions different from each other?
    Signals and Slots are built on top of callback concept, with added features like type safety, signal-to-signal, multi-slots, and cross-thread etc. At the core both Signals and Slots are plain C++ funcation calls (member functions)
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  5. The following user says thank you to Santosh Reddy for this useful post:

    ehnuh (7th November 2012)

Similar Threads

  1. Lambda callback functions
    By wayfaerer in forum Newbie
    Replies: 3
    Last Post: 12th March 2012, 11:33
  2. replacing signals and slots with callback functions
    By meena in forum Qt Programming
    Replies: 16
    Last Post: 23rd August 2010, 10:26
  3. Regards CallBack Functions
    By Tavit in forum Qt Programming
    Replies: 1
    Last Post: 19th September 2009, 17:16
  4. Pointers to Member Functions
    By Doug Broadwell in forum General Programming
    Replies: 8
    Last Post: 16th May 2007, 00:08
  5. array of pointers to functions
    By moowy in forum General Programming
    Replies: 3
    Last Post: 19th October 2006, 11:48

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.