Results 1 to 2 of 2

Thread: How can I get a return value from a signal and slot

  1. #1
    Join Date
    Dec 2009
    Posts
    22
    Thanks
    3
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default How can I get a return value from a signal and slot

    Hi All,
    I've been trying to work out how to get a return value from a signal/slot. But it seems I can't from googling. Basically what I have is a signal is sent to an error checker slot, the error checker checks everything if there's are error I want a error_flag set and the caller to drop out. So in pseudo code

    Qt Code:
    1. do
    2. {
    3.  
    4.  
    5. game loop
    6.  
    7.  
    8. }while( signal calls error check slot, if error set true if not flase and drop out )
    To copy to clipboard, switch view to plain text mode 

    so basically how to get the error back to the fuction that calls the signal
    Thanks in advance

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How can I get a return value from a signal and slot

    While a thread-local signal/slot connection is basically a direct function call and you can use input/output parameters (references or pointers), you should at least consider that a signal can be connected to more than one slot.

    Of course that is something you control, but it is often an indicator that a different kind of interaction pattern is more suitable than signal/slot.
    Like directly calling the other object's method.

    Cheers,
    _

Similar Threads

  1. slot return type
    By adamatic in forum Qt Programming
    Replies: 13
    Last Post: 4th October 2014, 22:01
  2. Replies: 8
    Last Post: 7th November 2012, 15:10
  3. Replies: 3
    Last Post: 23rd November 2011, 00:34
  4. Slot with a return value?
    By lalesculiviu in forum Qt Programming
    Replies: 9
    Last Post: 21st December 2009, 07:27
  5. Replies: 12
    Last Post: 14th June 2006, 10:24

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.