Results 1 to 2 of 2

Thread: "emit" keyword optional when calling signals?

  1. #1
    Join Date
    Jul 2007
    Posts
    56
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default "emit" keyword optional when calling signals?

    Is using the "emit" keyword before a signal function necessary? I forgot to add it so some cases when I call a signal, but they still seem to work.
    e.g.

    Qt Code:
    1. mySignal();
    To copy to clipboard, switch view to plain text mode 
    instead of
    Qt Code:
    1. emit mySignal();
    To copy to clipboard, switch view to plain text mode 

    I was wondering if there is any difference if I leave it out?

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

    Default Re: "emit" keyword optional when calling signals?

    emit is an empty macro but you should use it to increase readability.

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

    will49 (21st November 2008)

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.