Results 1 to 11 of 11

Thread: Performance with many filled polygons on screen

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Performance with many filled polygons on screen

    Quote Originally Posted by lni View Post
    Paint event is controlled by Qt, and redraw will be made when QGraphicsItem::paint is called.
    How do I use QGraphicsView in replace of QPainter?
    So are you using graphics view or not?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Performance with many filled polygons on screen

    Quote Originally Posted by wysota View Post
    So are you using graphics view or not?
    Yes, I am using QGraphicsView and QGraphicsScene. The scene contains 5000 polygons.

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

    Default Re: Performance with many filled polygons on screen

    Did you enable caching for the items? Also how did you define shape() and boundingRect() for your items? Did you make a QGLWidget the viewport of your view to enable hardware accelleration? To make things faster you can also mark the view as non-interactive, if you can afford it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Performance with many filled polygons on screen

    Quote Originally Posted by wysota View Post
    Did you enable caching for the items? Also how did you define shape() and boundingRect() for your items? Did you make a QGLWidget the viewport of your view to enable hardware accelleration? To make things faster you can also mark the view as non-interactive, if you can afford it.
    I didn't call setCacheMode so it is using NoCache. The graphics is zoomable and the xy scale can be changed interactively, so I suppose caching is not useful.

    The shape is not defined, and the bundingRect is properly computed. I don't use QGLWidget and have never used it. Does it work for both Linux and Window?

    I don't understand "mark the view as non-interactive". My graphics display is very interactive, such as zoom, scale changes, object selection, pen and brush can also be edited...

    When zoom in to small portion, it is fast because I recompute all sub-boundingRect so only render the portion of object really on screen. But not on "view all" mode.

  5. #5
    Join Date
    Sep 2009
    Posts
    140
    Thanks
    4
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Performance with many filled polygons on screen

    Interactive means thats your QGraphicsView is read only.

    Another advice for your problem :
    if you overload the paint method of your QGraphicsItem, you will find a QStyleOptionGraphicsItem as argument

    It stores the rect that need to be repaint, according to the ViewportUpdateMode of your view
    and the lod, that is the scale factor of your scene.

    Since the painter draw all edges of yours polygons, even if reduced all to one pixel, maybe you need to simplify it before displaying it

    S.Cascio

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
  •  
Qt is a trademark of The Qt Company.