Results 1 to 3 of 3

Thread: QGraphicsPixmapItem::setPixmap() renders very slow

  1. #1
    Join Date
    Jul 2010
    Posts
    21
    Qt products
    Qt4
    Platforms
    Windows

    Default QGraphicsPixmapItem::setPixmap() renders very slow

    Hi all,
    I have been implementing a Pencil Tool (image editing tool) which has a layer structure similar to the one in Adobe PhotoShop. Each layer contains a QPixmap to draw its content. Therefore, I have used QGraphicsView and QGraphicsPixmapItem to implement layer mechanism.
    The problem is that, when drawing on high resolution images, rendering is very slow. I have been using QGraphicsPixmapItem::setPixmap() method for pencil , and it tries to draw all the image again and again for every pencil move. I think it is the main reason. Is there any solution to render a smaller portion of a QGraphisPixmapItem:ixmap() instead of updating all the pixmap?
    Any idea is welcome.

  2. #2
    Join Date
    Mar 2010
    Location
    Heredia, Costa Rica
    Posts
    257
    Thanks
    24
    Thanked 17 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QGraphicsPixmapItem::setPixmap() renders very slow

    Try by exploring QGraphicsView::ViewportUpdateMode()

    If you set the update mode to QGraphicsView::NoViewportUpdate you can control the update process. You can schedule the redraw of an area with QGraphicsScene::update ( const QRectF & rect = QRectF() ) . Also check the void QGraphicsScene::changed ( const QList<QRectF> & region ) [signal].

    Carlos.

  3. #3
    Join Date
    Jul 2010
    Posts
    21
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QGraphicsPixmapItem::setPixmap() renders very slow

    Firstly, thanks a lot. However, i think we have dismatched on the issue. I am not considering update of the scene. My question is that how can I operate on few pixels of a QGraphicsPixmapItem's pixmap instead of using setPixmap? In other words, I have a problem on manipulating/changing data of a QGraphicsPixmapItem, not on updating its changed data on the screen.

Similar Threads

  1. Replies: 0
    Last Post: 31st December 2010, 13:08
  2. QGLWidget renders black
    By jonasbalmer in forum General Programming
    Replies: 2
    Last Post: 24th January 2010, 15:32
  3. What's the problem with setPixmap?
    By yagabey in forum Qt Programming
    Replies: 4
    Last Post: 21st November 2008, 16:34
  4. setPixmap
    By mgurbuz in forum Qt Programming
    Replies: 9
    Last Post: 13th July 2007, 13:37
  5. Qt renders wrong font
    By durbrak in forum Qt Programming
    Replies: 8
    Last Post: 2nd November 2006, 14:36

Tags for this Thread

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.