Results 1 to 2 of 2

Thread: What's the difference between calling QWidget::update() and QWidget::repaint()?

  1. #1
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default What's the difference between calling QWidget::update() and QWidget::repaint()?

    Hello!

    In Qwt's QwtPlotCanvas' replot() method, one may either call QWidget::update() or QWidget::repaint() depending on the "immediate paint" configuration.

    Is there any significant difference (specially in terms of performance) between using either one of those two methods apart from that QWidget::repaint() does his job immediately while QWidget::update() does not?


    Thanks,

    Momergil
    May the Lord be with you. Always.

  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: What's the difference between calling QWidget::update() and QWidget::repaint()?

    repaint() performs an immediate repaint, update() schedules an event. This means that
    Qt Code:
    1. for(int i=0;i<10;++i) repaint();
    To copy to clipboard, switch view to plain text mode 
    will do 10 repaints and
    Qt Code:
    1. for(int i=0;i<10;++i) update();
    To copy to clipboard, switch view to plain text mode 
    will do one repaint.
    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.


  3. The following user says thank you to wysota for this useful post:

    Momergil (30th May 2014)

Similar Threads

  1. Difference between QWidget and QMainWindow
    By daviddoria in forum Newbie
    Replies: 9
    Last Post: 9th July 2018, 20:06
  2. Replies: 3
    Last Post: 25th September 2012, 21:11
  3. Replies: 4
    Last Post: 17th October 2010, 23:30
  4. x11,about qwidget::repaint()
    By calmspeaker in forum Qt Programming
    Replies: 7
    Last Post: 9th December 2009, 07:50
  5. update() in QWidget
    By salmanmanekia in forum Qt Programming
    Replies: 5
    Last Post: 28th July 2008, 09:03

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.