Hi,
I need a file copy progress bar.
If (any body has)
{ pls send it to me; }
else
{
how to copy file byte by byte in Qt ;
how to keep file copy and progress bar in sync;
}
Hi,
I need a file copy progress bar.
If (any body has)
{ pls send it to me; }
else
{
how to copy file byte by byte in Qt ;
how to keep file copy and progress bar in sync;
}
QUrlOperator, QProgressDialog.
Copying byte by byte is very slow, it is better to use OS system calls to do that (at least through QFile::copy), but if you insist, something like this should work:
Qt Code:
qint64 len = src.bytesAvailable(); dlg->setRange(0,len); dlg->show(); char ch; while(!src.atEnd()){ src.getChar(&ch); dst.putChar(ch); dlg->setValue(dlg->value()+1); qApp->processEvents(); }To copy to clipboard, switch view to plain text mode
Is there any other way to copy file manually in Qt3.
What do you mean by "other" and "manually"? What's wrong with regular methods?
By "other" I mean other than above method (that u specify) to copy file. By manually I not using system calls.Originally Posted by wysota
What is wrong with QUrlOperator::copy() and connect to dataTransferred()
We can't solve problems by using the same kind of thinking we used when we created them
The method with reading and writing byte by byte doesn't satisfy you too?Originally Posted by safknw
It is quit slow, specially when u have to copy 80-100 Gb file.
When you want to copy a file about 80-100 GB in size, why do you want to copy Byte by Byte ? Why not in a block ?
And what is wrong with the Qt's copy functions ?
We can't solve problems by using the same kind of thinking we used when we created them
That's why they invented system calls that copy files without the need to transfer every byte of the file to userspace. If you don't want to use them, you have to stick with copying every byte of the file yourself (it will be slow no matter if you copy byte by byte or kilobyte by kilobyte).Originally Posted by safknw
Block by Block is OK but how.Originally Posted by sunil.thaha
Qt'copy functions is not availble in Qt 3.3.x
Are you sure?Originally Posted by safknw
QUrlOperator::copy()
My problem is that I have read the data from file, cypher/encrypt some part of it then save it to other file. I have to show the progress bar while doing this.
So is the problem about copying the file or showing the progress bar? QProgressDialog has all you need if latter is the case.
Bookmarks