Results 1 to 4 of 4

Thread: emit is slow in Thread?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: emit is slow in Thread?

    Quote Originally Posted by vishal.chauhan View Post
    OK.

    I will try this.

    I want to ask one more thing that can I take a return value from the emit signal because I want this QTreeWidgetItem pointer to be added in the list which is in thread.
    No, you can't have a return value for a signal./ This is mainly because you don't actually implement the signals. You just declare them. The "implementation" is done by moc.

    Qt Code:
    1. because I want this QTreeWidgetItem pointer to be added in the list which is in thread
    To copy to clipboard, switch view to plain text mode 
    Create a small class or struct that has a few members(public, nothing fancy).
    You emit the signal with this an instance of this class as parameter. In the worker thread, before you emit, populate the class with the needed data( the tree item, and whatever you may need in the GUI thread, when you receive the signal ).

    Be careful that when emitting signals with custom types, these types have to be registered with Qt.

    See qRegisterMetaType.

    Regards

  2. The following user says thank you to marcel for this useful post:

    vishal.chauhan (2nd August 2007)

Similar Threads

  1. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  2. Replies: 10
    Last Post: 20th March 2007, 22:19
  3. Problem closing a QMainWindow in Qt4.2
    By ian in forum Qt Programming
    Replies: 11
    Last Post: 17th October 2006, 00:49
  4. How and when to repaint a widget ?
    By yellowmat in forum Newbie
    Replies: 7
    Last Post: 3rd April 2006, 16:36
  5. Replies: 2
    Last Post: 6th January 2006, 21:15

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
  •  
Qt is a trademark of The Qt Company.