Results 1 to 2 of 2

Thread: QProcess: several processes connected to same slot - how to find out which emitted?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QProcess: several processes connected to same slot - how to find out which emitte

    Quote Originally Posted by ghorwin View Post
    Since I do that for each process created, I have the problem of finding out which process actually emitted the signal. ... I would like to know exactly, which of the processes emitted the finished() signal. How would I do that best?
    One could use QObject::sender():
    Qt Code:
    1. void Receiver::someSlot()
    2. {
    3. QProcess* process = qobject_cast<QProcess*>(sender());
    4. if (process)
    5. {
    6. ...
    7. }
    8. }
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  2. The following 2 users say thank you to jpn for this useful post:

    ghorwin (6th March 2007), ottocode (21st July 2007)

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
  •  
Qt is a trademark of The Qt Company.