Results 1 to 3 of 3

Thread: emit a signal

  1. #1
    Join Date
    Feb 2006
    Posts
    209
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default emit a signal

    Just a quick one, if I wish to emit a signal from a specific object, I can do like this, right?

    emit myObject->mySignal();

    Update: There doesn't seem to be any way of making a signal public. Or is there?
    Last edited by Morea; 26th February 2006 at 13:18.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: emit a signal

    You can connect some other signal to it:
    Qt Code:
    1. connect( object1, SIGNAL( someSignal() ), object2, SIGNAL( someOtherSignal() ) );
    To copy to clipboard, switch view to plain text mode 
    Whenever object1 emits someSignal(), object2 will emit someOtherSignal().

  3. #3
    Join Date
    Jan 2006
    Location
    New Malden (near London)
    Posts
    32
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: emit a signal

    Quote Originally Posted by Morea
    Just a quick one, if I wish to emit a signal from a specific object, I can do like this, right?

    emit myObject->mySignal();

    Update: There doesn't seem to be any way of making a signal public. Or is there?
    Objects can only emit their own signals (including inherited ones), not others'. Signals are protected functions and when the compiler reads your headers, it reads "protected:" rather than "signals:"; short of altering the Qt source code itself, you can't change this. This is covered in "Practical Qt" on page 231.

Similar Threads

  1. emit qt signal is very slow how it can be optimized?
    By sawerset in forum Qt Programming
    Replies: 8
    Last Post: 30th December 2008, 10:21
  2. pthread instead QThread
    By brevleq in forum Qt Programming
    Replies: 8
    Last Post: 23rd December 2008, 08:16
  3. Connection of custon signals/slots
    By brevleq in forum Qt Programming
    Replies: 2
    Last Post: 23rd December 2008, 08:04
  4. how to know which button emit the signal?
    By coder1985 in forum Qt Programming
    Replies: 2
    Last Post: 12th January 2008, 15:26
  5. From extends QTreeWidgetItem emit signal?
    By patrik08 in forum Qt Programming
    Replies: 4
    Last Post: 19th May 2006, 15:54

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.