PDA

View Full Version : ACE Thread and QT signal or event



opengllove
27th December 2013, 04:17
I create a TCP server use ACE.
I use an ace thread (ACE_Task) to receive messages from client.

what I want to do IS:

when a message arrived,I want to show it on the main window (QMainWindow)

In QT, we could use signal to connect a QThread and a QMainWindow,
but I use ACE thread, which is not a QObject drived type,
so I can't use connect to connect an ACE thread with QMainWindow.

Are there any solutions to this problem?

Thank you gurus

Added after 1 16 minutes:

I have found the solution
just as bellow:

class CMyThread: public QObject,public ACE_Task<ACE_MT_SYNCH>
{
};

problem solved.

anda_skoa
27th December 2013, 13:07
Just for completness :)

an alternative way of invoking slots in a different thread is by using QMetaObject::invokeMethod and connection type Qt::QueuedConnection.

For example invoking QLabel::setText() from a different thread


QMetaObject::invokeMethod( pointerToLabel, "setText", Qt::QueuedConnection, Q_ARG( QString, text ) );


Cheers,
_