Results 1 to 5 of 5

Thread: draw picture and update

  1. #1
    Join Date
    Mar 2011
    Posts
    42
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default draw picture and update

    hi, i use double buffer draw wave(not in the paintEvent fun), first i draw wave in a QPixmap, then i use update fun to invoke paintEvent fun draw QPixmap, because invoke update fun more first, so use CPU more, i see the qt helper, the update fun is use to update the widget, but now i do not want to update the widget, i only want update my drawed picture, so please help have any good methods to show the picture in screen. thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: draw picture and update

    but now i do not want to update the widget, i only want update my drawed picture,
    you can use update(const QRect & rect ) to update only part of the widget.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Mar 2011
    Posts
    42
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: draw picture and update

    yea, i only use update() to update rectangle zone, but because of invoke update() more times(about 25/s), so i want if have more good fun to instead of update().

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: draw picture and update

    I don't understand.
    The changes you made need to be rendered, and if you call update with the rect to be updated, or another function with the rect to be updated where is the difference?
    Both will have to be called every time you need to redraw.

    As a side note, calling update at 25 fps, does not mean that the frame gets updated 25 times a second, as update() registers an event, and only if an update is needed, the event will be executed. It therefore likely, specially if you have large portions to draw, that an update() call will NOT issue a new paintEvent().
    You might need to call repaint() instead, which is a direct call.
    Read the documentation for update() for more details.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    Mar 2011
    Posts
    42
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: draw picture and update

    yea, you are right, the update() itself have optimization function; in here i think use repaint() not well, this maybe use CPU more.

Similar Threads

  1. How to create PIP (Picture In Picture) on QwebView
    By luckychap in forum Qt Programming
    Replies: 0
    Last Post: 18th July 2011, 12:47
  2. Replies: 10
    Last Post: 10th February 2011, 23:31
  3. Replies: 2
    Last Post: 29th September 2010, 17:44
  4. Raw Pixel Data to Image or Picture, to draw in a Widget
    By augusbas in forum Qt Programming
    Replies: 1
    Last Post: 7th September 2010, 13:15
  5. can't load picture
    By aoo7wangyan in forum Qt Programming
    Replies: 9
    Last Post: 13th July 2009, 14:59

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.