PDA

View Full Version : Refreshing problem



jaime
24th August 2006, 20:09
Hello, I'm having some problems when I try to repaint() a window.
I'm using signals and in the slot function I'm printing the values I send to it, and I can see values like 5, 10, 15,20,25... etc, but the QProgressBar I pass to those values only appears some times, like 15, 35, 70... the others seem to get lost due to refreshing problems.
This happens when I load a file and make some (many) operations and I emit a signal every 5% completed. But only some of these values appears in the ProgressBar.
It happens algo with the entire window (the menu's) doesn't refresh while I'm doing the loading of the file.
So.. there is some way to force the repainting of a window? or to force the completition of the signals?

Thanks

Jaime

jpn
24th August 2006, 20:14
Try calling


qApp->processEvents();

once in a while during the long lasting operation. See QProgressDialog's Detailed description for explanation.

jaime
24th August 2006, 20:23
It worked! Thanks!

I read many tutorials of the qt-webpage but I didn't find this, what source for information would be good for qt-developing? Maybe a web or some book?
I'm newbie in this topic

Thanks a lot

Jaime

pherthyl
24th August 2006, 22:09
Just the documentation is usually enough to figure out how something works. For example, if you look at the documentation for QProgressDialog, under Detailed Description, you will find:


Using a modal QProgressDialog is simpler for the programmer, but you must call QApplication::processEvents() or QEventLoop::processEvents(ExcludeUserInput) to keep the event loop running to ensure that the application doesn't freeze.