I'd like to have a progress dialog for writing to a TCP socket but I'm unsure as to which QTcpSocket signal to connect to QProgressDialog::setvalue().
Can anyone help?
Thanks!
I'd like to have a progress dialog for writing to a TCP socket but I'm unsure as to which QTcpSocket signal to connect to QProgressDialog::setvalue().
Can anyone help?
Thanks!
There is no such signal. You need to keep track of how much you have written to the socket yourself.
There's no meaningful measure to be had from a signal AFAICT: no signal carries a cumulative total. When your code writes, update the progress bar however you want.
Edit: Pipped by wysota.
So I would have to do something like dividing my file into appropriately sized chunks,writing each chunk (then wait for waitForBytesWritten signal) and update the progress bar?
How and what you write to the socket is meaningless to the problem. You can use QIODevice::bytesWritten() signal to measure how much was really written to the device but keeping track of how much is left (aka what's the total number of bytes) is what you need to do manually.
Bookmarks