Results 1 to 5 of 5

Thread: get finished signal from a thread

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2009
    Location
    São Paulo - Brasil
    Posts
    20
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default get finished signal from a thread

    Hello boys,

    I am trying to implement a thread into my gui application.
    I intend to use this thread to make calcs and show the results in a table after this.
    Well, I need get a finish signal from my thread and get the values to put into my tables.

    how do I get this signal.

    I´ve tried:
    Qt Code:
    1. connect(thread, SIGNAL(finished()), SLOT(ThreadStop()));
    To copy to clipboard, switch view to plain text mode 

    But my application never enter in the slot threadstop.

    Someone knows why?

    Thanks in advanced.

  2. #2
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: get finished signal from a thread

    Please check the return value of your connect statement.

  3. #3
    Join Date
    Jul 2009
    Location
    São Paulo - Brasil
    Posts
    20
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: get finished signal from a thread

    Thanks for the reply, yogeshgokul.

    I´ve received: 1, but

    Upon successful completion, connect() shall return 0; otherwise, -1 shall be returned and errno set to indicate the error.

    Receiving 1 is new to me, well that is possible an error, I´ll try to check why.

  4. #4
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: get finished signal from a thread

    Quote Originally Posted by ProTonS View Post
    Receiving 1 is new to me, well that is possible an error, I´ll try to check why.
    1 means true. Connect return bool not int.
    So your connect is fine.

    You need to show your code for more info.
    There are several common mistakes people does in case of signal-slots.
    Like:
    1. Missing Q_OBJECT macro in header.
    2. Missing to declare slots under slots section.

  5. The following user says thank you to yogeshgokul for this useful post:

    ProTonS (21st August 2009)

  6. #5
    Join Date
    Jul 2009
    Location
    São Paulo - Brasil
    Posts
    20
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: get finished signal from a thread

    I think is ok since the beginning, but I could not realize this. I put a loop inside the slot statement and the application become freeze. Now I just need find out why its freeze.

    Well, thanks for your help, yogeshgokul.

    cye.

Similar Threads

  1. pthread instead QThread
    By brevleq in forum Qt Programming
    Replies: 8
    Last Post: 23rd December 2008, 08:16
  2. Connection of custon signals/slots
    By brevleq in forum Qt Programming
    Replies: 2
    Last Post: 23rd December 2008, 08:04
  3. Close a thread with a signal
    By victor374 in forum Qt Programming
    Replies: 1
    Last Post: 30th November 2007, 07:33
  4. creating treeWidgetItem using emitted signal from thread class
    By santosh.kumar in forum Qt Programming
    Replies: 1
    Last Post: 25th June 2007, 09:37
  5. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 07:13

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.