Results 1 to 6 of 6

Thread: How to find out scene update time

  1. #1
    Join Date
    Sep 2007
    Location
    Pune, India
    Posts
    60
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to find out scene update time

    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 ?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to find out scene update time

    Subclass the view, reimplement drawItems() and use QTime and its elapsed() method to calculate how much it takes for drawItems() to perform its task.

  3. #3
    Join Date
    Sep 2007
    Location
    Pune, India
    Posts
    60
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to find out scene update time

    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)
    {

    }

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to find out scene update time

    "QGraphicsItem []*" -> "QGraphicsItem *[]"
    J-P Nurmi

  5. #5
    Join Date
    Sep 2007
    Location
    Pune, India
    Posts
    60
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to find out scene update time

    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 ??

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to find out scene update time

    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 (";").
    J-P Nurmi

Similar Threads

  1. How to find the presence of scroll bars at run time
    By anju123 in forum Qt Programming
    Replies: 8
    Last Post: 28th July 2007, 20:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.