Qt World Summit: Submit your Presentation

Qt Data transfer

  • hello! I have 2 unrelated questions:

    1. Is there a way to hold the main in a wait mode?
      meaning the main will pass the return a.exec(); (a is a Qapplication) and enter a wait mode until his subprocesses will end(the gui for example).

    2. I'm streaming a video through netcat to a socket. from that socket I need to stream the data to an mplayer process.
      I've managed to do that through this code:
      void ClientVidless::run()
      socket = new QTcpSocket(this);
      QStringList args1;

      args1 += "-fps";
      args1 += "60";
      args1 += "-cache";
      args1 += "1024";
      args1 += "-slave";
      args1 += "-wid";
      args1 += QString::number((int)ui->widget->winId());
      args1 += "-";

      process1 = new QProcess(0);

      process1->start("C:\Program Files (x86)\MPlayer for Windows\mplayer.exe",args1);

      qDebug() << "Connecting...";


      if (!socket->waitForConnected(1000))
      qDebug() << "Error:" << socket->errorString();



    void ClientVidless::readyRead()

    Data = socket->readAll(); //Data is a QByteArray
    qDebug() << " Data in: " << Data;


    simply when ready read is emitted the socket is read and then writing to the process.
    The problem is that the video is really slow with a lot of lag.
    What is the best and fastest way in transferring data into a process?
    What is the difference between read/write to readdata/writedata functions, and how to use them(they're virtual protected)?
    Thanks for the helpers.

Log in to reply