
Originally Posted by
wysota
Can you post some code of yours here?
Which part(s) do you want?
In the connection thread I have this:
if ( has_target ) {
cout << "Have target. " ;
if ( have_terminator ) {
cout << "Have terminator " <<endl;
action = emit getActionForTarget(target);
if ( has_target ) {
cout << "Have target. " ;
if ( have_terminator ) {
cout << "Have terminator " <<endl;
action = emit getActionForTarget(target);
To copy to clipboard, switch view to plain text mode
Which as you can see is where the signal is emitted. The couts before and after the emit do indeed print out.
The QTcpServer based class has:
void Server::incomingConnection(int socketDescriptor) {
DBServerA* dbserver = &db;
ConnectionThread *thread = new ConnectionThread(socketDescriptor, this);
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()), Qt::DirectConnection );
connect(thread, SIGNAL(getActionForTarget()), dbserver, SLOT(getActionForTarget()), Qt::DirectConnection );
thread->start();
}
void Server::incomingConnection(int socketDescriptor) {
DBServerA* dbserver = &db;
ConnectionThread *thread = new ConnectionThread(socketDescriptor, this);
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()), Qt::DirectConnection );
connect(thread, SIGNAL(getActionForTarget()), dbserver, SLOT(getActionForTarget()), Qt::DirectConnection );
thread->start();
}
To copy to clipboard, switch view to plain text mode
and the slot in the dbserver (a QObject) is:
int DBServerA
::getActionForTarget( QString target
) { qDebug() << "getAction called for target" <<target <<endl;
int action = 0;
}
int DBServerA::getActionForTarget( QString target ) {
qDebug() << "getAction called for target" <<target <<endl;
int action = 0;
}
To copy to clipboard, switch view to plain text mode
(Yes other debug statements are showing up.
)
The original code for the tcpserver came from the qt-interest list, (http://lists.trolltech.com/qt-intere...ad01010-0.html) and as I said works exactly as expected ... except of course that the signal to the dbobject does seem to be getting emitted (or maybe it is but nobody is listening).
Bookmarks