[Qt-interest] QProcessBar while read file

Ulf-Alexander v. Ceumern-Lindenstjerna ceumern at vrmagic.com
Wed Oct 14 14:18:20 CEST 2009


Hi,

QProgressDialog is your friend:

http://doc.trolltech.com/4.5/qprogressdialog.html

see examples:

     QProgressDialog progress("Copying files...", "Abort Copy", 0,
numFiles, this);
     progress.setWindowModality(Qt::WindowModal);

     for (int i = 0; i < numFiles; i++) {
         progress.setValue(i);

         if (progress.wasCanceled())
             break;
         //... copy one file
     }
     progress.setValue(numFiles);


Cheers, Ulf

> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> bounces at trolltech.com] On Behalf Of Mhayk Whandson
> Sent: Wednesday, October 14, 2009 2:00 PM
> To: Qt Interest (qt-interest at trolltech.com)
> Subject: [Qt-interest] QProcessBar while read file
> 
> Hi all,
> 
> I would like using qprocessbar while my application read the text
> file, How can I do ? The code is following:
> 
>   QFile file(m_ui->lineEdit->text());
> 
>     if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
>         return;
> 
>     while(!file.atEnd()) {
>         QByteArray line = file.readLine();
>         qDebug() << line;
>     }
> 
> best regards,
> 
> --
> Mhayk Whandson
> Linux User #413723
> E-mail: eu at mhayk.com.br
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list