Results 1 to 7 of 7

Thread: Refresh my Qt window

  1. #1
    Join Date
    Mar 2011
    Posts
    51
    Thanks
    7
    Qt products
    Qt3 Qt4 Qt/Embedded

    Default Refresh my Qt window

    hello every one i am having a problem that i have a listview in my Qt creator program
    and values of list is changing after few seconds i have called a time event.it is working fine as i can see my changing values of list but the problem is that the changing values seems to be visible when i minimize and the maximize the window or when i resize it.
    is there any refresh type thing.
    how can i view the the change in my list with out doing this resize or min max thing
    hope you people getting what i want to say

    kindly help me

    thanks alot

  2. #2
    Join Date
    Apr 2011
    Posts
    61
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Refresh my Qt window

    You can call update or updateGeometry function or can also send a resizeEvent with no change I think.

  3. #3
    Join Date
    Mar 2011
    Posts
    51
    Thanks
    7
    Qt products
    Qt3 Qt4 Qt/Embedded

    Default Re: Refresh my Qt window

    ok sir thanks alot can you please give me a little more detail. i will be very thankful

  4. #4
    Join Date
    Apr 2011
    Posts
    61
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Refresh my Qt window

    When you resize a window it need to repaint the child windows. So, you can force the repainting after changing these values.

    To force repainting I think you can try this: (I've never needed to do this, but I think it will work)

    You can call this function (recommended):
    Qt Code:
    1. void QWidget::update() [slot]
    To copy to clipboard, switch view to plain text mode 
    And if it doesn't work you can try:
    Qt Code:
    1. void QWidget::repaint() [slot]
    To copy to clipboard, switch view to plain text mode 

    In the help you can find this notes:

    About update:
    This function does not cause an immediate repaint; instead it schedules a paint event for processing when Qt returns to the main event loop. This permits Qt to optimize for more speed and less flicker than a call to repaint() does.

    Warning about using repaint:
    We suggest only using repaint() if you need an immediate repaint, for example during animation. In almost all circumstances update() is better, as it permits Qt to optimize for speed and minimize flicker.


    I think calling the update will work.

  5. #5
    Join Date
    Mar 2011
    Posts
    51
    Thanks
    7
    Qt products
    Qt3 Qt4 Qt/Embedded

    Default Re: Refresh my Qt window

    thanks so much 4 your concern but its still not working


    Added after 7 minutes:


    i have write code like
    QWidget q;
    q.update();

    am i writing it correctly i mean that what is QWidget in my case

    (sorry if my questions are annoying i am completely new to qt)
    Last edited by maarvi; 8th May 2011 at 17:10.

  6. #6
    Join Date
    Apr 2011
    Posts
    61
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Refresh my Qt window

    The QListWidget is derived from QWidget.
    So, to update a list widget, call the member function ^^.
    Just do this:

    Qt Code:
    1. // Don't declare a new QListWidget for calling update,
    2. // just call the update from the one that you're using in the window.
    3.  
    4. listWidget->update();
    To copy to clipboard, switch view to plain text mode 

  7. #7
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Refresh my Qt window

    If rsilva advice doesn't work, tell us your Qt version and the OS - if i remember correctly there was a similar bug in Qt version ~4.5

    //i'm not sure about version number and not sure if the QListWidget had the update bug - i just remember that i saw sometime ago a similar problem caused by a bug.

Similar Threads

  1. Replies: 2
    Last Post: 17th February 2011, 12:30
  2. Replies: 2
    Last Post: 14th January 2011, 15:09
  3. window refresh freeze
    By jhowland in forum Qt Programming
    Replies: 1
    Last Post: 22nd February 2010, 07:58
  4. QPainter and refresh window
    By Atikae in forum Qt Programming
    Replies: 3
    Last Post: 18th February 2009, 12:45
  5. Want to refresh window without processEvents()
    By jnk5y in forum Qt Programming
    Replies: 6
    Last Post: 31st March 2006, 00:32

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.