Results 1 to 2 of 2

Thread: how to get data from signal?

  1. #1
    Join Date
    Nov 2010
    Posts
    31
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Question how to get data from signal?

    assume,I have
    connect(obj1,SIGNAL(changestatus(int),obj2,SLOT(ge tdata()));
    how I get int value in signal from getdata function?

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: how to get data from signal?

    Use a slot that has an int parameter, something like:
    Qt Code:
    1. void CLASSNAME::getData(int inValue){
    2. //use the value
    3. }
    4. //to connect use:
    5. connect(obj1,SIGNAL(changestatus(int),obj2,SLOT(getdata(int))); //you only write the type at the connect statement
    To copy to clipboard, switch view to plain text mode 
    Read more here

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

    banlinhtienphong (28th April 2011)

Similar Threads

  1. Passing data via signal/slot
    By gib in forum Qt Programming
    Replies: 4
    Last Post: 1st November 2010, 05:49
  2. Replies: 1
    Last Post: 23rd January 2010, 22:04
  3. disconnect SIGNAL/SLOT directly after emitting data
    By donglebob in forum Qt Programming
    Replies: 1
    Last Post: 4th February 2009, 22:53
  4. Replies: 1
    Last Post: 3rd December 2008, 15:51
  5. sending data over signal
    By gyre in forum Newbie
    Replies: 1
    Last Post: 16th December 2007, 23:10

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.