Results 1 to 2 of 2

Thread: disconnect SIGNAL/SLOT directly after emitting data

  1. #1
    Join Date
    Jul 2008
    Posts
    66
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default disconnect SIGNAL/SLOT directly after emitting data

    Hi,

    I want to make sth. like a demux.
    When data comes..i need to connect to the right destination thread, send the data and disconnect again.
    otherwise when I wouldnt disconnect...next time the emitting of the data would cause that a wrong destination would receive data.

    Is it ok to do this?

    connect(.....);
    emit senmydata(data);
    disconnect(.....);

    The receiver of the data is in another thread.

  2. #2
    Join Date
    May 2008
    Posts
    155
    Thanked 15 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: disconnect SIGNAL/SLOT directly after emitting data

    Quote Originally Posted by donglebob View Post
    Hi,

    I want to make sth. like a demux.
    When data comes..i need to connect to the right destination thread, send the data and disconnect again.
    otherwise when I wouldnt disconnect...next time the emitting of the data would cause that a wrong destination would receive data.

    Is it ok to do this?

    connect(.....);
    emit senmydata(data);
    disconnect(.....);

    The receiver of the data is in another thread.
    QMetaObject::invokeMethod(...) might be a path to take, too...

Similar Threads

  1. Replies: 16
    Last Post: 28th October 2008, 22:00

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.