[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: KProgressbar and intensive calculations
From: Bram Biesbrouck <b () beligum ! org>
Date: 2006-02-17 9:16:13
Message-ID: 200602171016.13937.b () beligum ! org
[Download RAW message or body]
Op vrijdag 17 februari 2006 08:47, schreef Iván Forcada Atienza:> Hi>> [Fri, 17 Feb 2006 08:27:27 +0100] - Bram Biesbrouck:> > Hi all,> >> > I'm using a KProgressBar to indicate the progress of an intensive> > calculation-loop. My problem is that, because of the calculations, the> > progressbar doesn't get enough time to fully initialize, before the> > processor gets flooded.> > Can anyone supply a solution to this?>> Are you using qApp->processEvents()?? Here you have some sample code:>> KProgressDialog prog;> prog.setAllowCancel(TRUE);> prog.setModal(TRUE);> prog.setMinimumDuration(500); // Wait 0,5 sec. until the progressbar> appears. Good for quick processings. // calculations loop> for ( int i = 0; i < somevalue; i++ )> {> prog.progressBar()->setProgress( 100*i/somevalue );> if ( prog.wasCancelled() )> break;> qApp->processEvents()> // Calculations> [...]> }
I suppose prog.show() or prog.exec() must come before the loop?And btw, which one of the two?
b. >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic