Results 1 to 6 of 6

Thread: Emit Signal From Another Class

  1. #1
    Join Date
    Apr 2012
    Location
    Bali - Indonesia
    Posts
    9
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Emit Signal From Another Class

    Hi All,

    Why my slot does not display 'qdebug()' text?

    Class A
    --> instance to B
    --> Catch Signal and running local slot.

    Class B
    --> emit signal


    attached the complete code..

    Regards,
    Mardi
    Attached Files Attached Files

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Emit Signal From Another Class

    Because SecondClass emits signal before connecting.

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

    mardi (26th November 2012)

  4. #3
    Join Date
    Apr 2012
    Location
    Bali - Indonesia
    Posts
    9
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Emit Signal From Another Class

    Quote Originally Posted by Lesiok View Post
    Because SecondClass emits signal before connecting.
    thanks for the correction..
    stupid me

  5. #4
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Emit Signal From Another Class

    Use connect in either first or second class and emit it after that.

  6. #5
    Join Date
    Nov 2014
    Location
    Chennai
    Posts
    160
    Thanks
    65
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Emit Signal From Another Class

    i executed his code i to dont get that qDebug(),as you said before connecting it emit signals,my doubt is how to connect before it emit signals give me example please
    Quote Originally Posted by Lesiok View Post
    Because SecondClass emits signal before connecting.

  7. #6
    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: Emit Signal From Another Class

    The example is trying to emit a signal in an object's constructor.
    Naturally it can't be connected yet since the object does not exist yet at this point.

    So the fix is not to connect differently but to not emit signals from a constructor.

    Cheers,
    _

Similar Threads

  1. [PyQt] send and emit an customer class....
    By cascoin in forum Qt Programming
    Replies: 5
    Last Post: 25th July 2013, 18:25
  2. QThread class does emit signal
    By saman_artorious in forum Qt Programming
    Replies: 2
    Last Post: 14th June 2012, 15:10
  3. emit signal and recognizing in a different class
    By salmanmanekia in forum Newbie
    Replies: 11
    Last Post: 18th October 2011, 08:19
  4. Replies: 2
    Last Post: 3rd May 2011, 20:22
  5. emit a signal
    By Morea in forum Qt Programming
    Replies: 2
    Last Post: 27th February 2006, 11:14

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.