Results 1 to 4 of 4

Thread: emit with destination

  1. #1
    Join Date
    Apr 2014
    Posts
    53
    Thanks
    9

    Default emit with destination

    Hi,
    I need to emit a signal to a certain destination object, is this possible ? Checkted the emit() keyword and it doesn't accept any parameter except signal name.

    TIA

  2. #2
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: emit with destination

    Please define what you mean by "emit a signal to a certain destination object".

    Here is a possible interpretation of this phrase: "make a QObject o emit one of its signals s". This seems strange, because o is expected to decide for itself when it is appropriate to emit s. Nevertheless, one way of doing it is to call o.someMethod(), where someMethod() executes emit s(...). Or, especially if you have no control on o's class, have another QObject emit a signal which is connected to o.s; the connection will cause o to emit s.

    Here is another possible interpretation: "execute a slot s of a QObject o". Slots are regular methods; you can simply call o.s().

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: emit with destination

    If you know the destination object then you can just call its method directly. Signals are meant to be destination-agnostic.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Apr 2014
    Posts
    53
    Thanks
    9

    Default Re: emit with destination

    sorry, that's exatly what I need: call the slot of an object directly
    because I have access to the class, I am writing it actually.
    thanks yeye.
    regards

Similar Threads

  1. Seems that my emit doesn't emit the signal
    By roseicollis in forum Newbie
    Replies: 2
    Last Post: 19th January 2015, 16:05
  2. lp error : no default destination available
    By daudiam in forum Newbie
    Replies: 4
    Last Post: 17th October 2010, 19:46
  3. QUdpSocket - how to get destination address of a datagram?
    By nelliekins in forum Qt Programming
    Replies: 0
    Last Post: 17th September 2009, 08:59
  4. Multiple destination target
    By mdecandia in forum Qt Programming
    Replies: 9
    Last Post: 13th June 2007, 16:42

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.