PDA

View Full Version : How to find out scene update time



nileshsince1980
19th September 2007, 12:24
Hi
I want to know How much time required to update the scene in GraphicsView for scaling, loading.
If you have added 40K > items in scene then how much time it takes to show and load all items ???
for scaling, scene's update() schedules the paint event but it doesnt repaint immediately.
How to calulate time required ?

wysota
19th September 2007, 13:25
Subclass the view, reimplement drawItems() and use QTime and its elapsed() method to calculate how much it takes for drawItems() to perform its task.

nileshsince1980
20th September 2007, 07:21
Hi, I tried but got following error

error C2259: 'QGraphicsItem' : cannot instantiate abstract class
due to following members:
'QRectF QGraphicsItem::boundingRect(void) const' : pure virtual function was not defined

Can you tell me what is wrong

class MyView : public QGraphicsView
{
Q_OBJECT
.
.
.
private:
virtual void drawItems(QPainter * painter, int numItems, QGraphicsItem []*items, const QStyleOptionGraphicsItem[] options);
}

//In MyView.cpp

void MyView::drawItems(QPainter * painter, int numItems, QGraphicsItem []* items, const QStyleOptionGraphicsItem[] options)
{

}

jpn
20th September 2007, 09:19
"QGraphicsItem []*" -> "QGraphicsItem *[]"

nileshsince1980
20th September 2007, 09:38
I changed but now I am getting error like

myView.cpp(52) : error C2146: syntax error : missing ')' before identifier 'items'
myView.cpp(52) : error C2146: syntax error : missing ';' before identifier 'items'
myView.cpp(52) : error C2761: 'void myView::drawItems(QPainter *,int,QGraphicsItem *[],const QStyleOptionGraphicsItem [])' : member function redeclaration not allowed
myView.cpp(52) : error C2501: 'items' : missing storage-class or type specifiers
myView.cpp(52) : error C2146: syntax error : missing ';' before identifier 'options'
myView.cpp(52) : error C2501: 'QStyleOptionGraphicsItem' : missing storage-class or type specifiers
myView.cpp(52) : warning C4228: nonstandard extension used : qualifiers after comma in declarator list are ignored
myView.cpp(52) : error C2059: syntax error : ')'
myView.cpp(53) : error C2470: 'options' : looks like a function definition, but there is no formal parameter list; skipping apparent body

Can you tell me what is problme exactly ??

jpn
20th September 2007, 09:46
At least the function declaration (in .h) differs from its definition (in .cpp). You must have applied the change to only either one. There might be some other syntactical problems as well but unfortunately I've got to go now. Ensure that you've got suitable includes and that the class declaration ends to a semi-colon (";").