Display progress bar as copying one file
时间:2010-08-01 来源:bezstudio
01.class MyClass : ...
02.{
03....
04.public slots:
05. void onWrite( qint64 );
06.};
07.
08.MyClass::MyClass( ... )
09.{
10. // ...
11. progress->setMaximum( QFileInfo(fromFile).size() / 1024 );
12. written = 0;
13. connect( &toFile, SIGNAL(bytesWritten(qint64)), SLOT(onWrite(qint64)) );
14. // ...
15.}
16.
17.void MyClass::onWrite( qint64 w )
18.{
19. written += w;
20. progress->setValue( written / 1024 );
21.}
02.{
03....
04.public slots:
05. void onWrite( qint64 );
06.};
07.
08.MyClass::MyClass( ... )
09.{
10. // ...
11. progress->setMaximum( QFileInfo(fromFile).size() / 1024 );
12. written = 0;
13. connect( &toFile, SIGNAL(bytesWritten(qint64)), SLOT(onWrite(qint64)) );
14. // ...
15.}
16.
17.void MyClass::onWrite( qint64 w )
18.{
19. written += w;
20. progress->setValue( written / 1024 );
21.}
相关阅读 更多 +