PDA

View Full Version : Finish of PaintEvent



jimfan
6th March 2008, 20:39
Hi all I know this sounds weird, but is there anyway for the app to know the paint for a specific widget has completed and everything's displayed? Thanks.

wysota
6th March 2008, 22:30
Yes and no :) Directly no, indirectly yes. What do you need it for?

jimfan
7th March 2008, 07:04
Got into this performance measurement thing on windows CE, we need to know how long did it take for paintEvent to complete painting. Indirect answer please. :p

wysota
7th March 2008, 07:50
In that case subclass the widget class you want to benchmark and reimplement its paintEvent. In the reimplementation write something like this:

void MyClass::paintEvent(QPaintEvent *e){
QTime t;
BaseClass::paintEvent(e);
qDebug() << t.elapsed();
}

An alternative is to reimplement event() or QApplication::notify() and do roughly the same there, but you'll get a bit different times.