Hi.
I ve got a plugin in which a write some data into the socket:
Code:
... stream << quint32(Data::PluginData) << name << quint32(ProgramViewerMenu::NewImage) << shot.toImage(); screen = shot.toImage(); return array; ... socket->write(array);
And in another program I have slot read() which is connected to readyRead() signal of socket.
Code:
void Connection::read() { DataThread *thread = new DataThread(socket, this); connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()) ); thread->start(); }
DataThread run() function:
Code:
void DataThread::run() { QByteArray array; array = socket->readAll(); quint32 dataType; streamOut >> dataType; qDebug() << "data thread dataType" << dataType; /* QString name; streamOut >> name; qDebug() << name;*/ if (dataType == Data::ServerData) emit serverData(array); if (dataType == Data::PluginData) emit pluginData(array); }
pluginData signal of DataThread is connected to pluginData slot. In this slot I want to read plugin name which was written in plugin function.
qDebug() << name gives me nothing, null string but I have no idea why. When I tray to read plugin name in thread class before returning array it works. Whats wrong?
Sorry about me english.
