Results 1 to 4 of 4

Thread: Refreshing program state after a certain amount of time

  1. #1
    Join Date
    Feb 2010
    Posts
    68
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Refreshing program state after a certain amount of time

    Good Evening and Happy Easter,

    I'm working on a p2m client, and I made a class to represent particular downloaded files. After having the necessary data given by user, I want to show the info about added file in a table. I made such table, where 1 file = 1 row. Apart of file name, file size, output folder, there are some data which should change dynamically - amount of currently downloaded kBs, progress bar indicating how many percents of the file size were currently downloaded, file state (downloading, preparing, paused, error). I don't know what is the best way to do it. Should I refresh program state every x seconds? How?

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Refreshing program state after a certain amount of time

    Use a QTimer to update the ui every second - thats more CPU friendly.

  3. #3
    Join Date
    Feb 2010
    Posts
    68
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Refreshing program state after a certain amount of time

    But how to do it "in the background"? I mean, user is using the program all the time (he runs a lot of functions, slots, opens additional windows, etc.) but the ui is still updating (independently!).

  4. #4
    Join Date
    Feb 2010
    Posts
    68
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Refreshing program state after a certain amount of time

    Ok, I've taken a look on the QTimer class and it is really convienient and easy. Thank you for your response then, fatjuicymole.

Similar Threads

  1. Limit Amount of Text in a QTextEdit
    By johnmauer in forum Newbie
    Replies: 1
    Last Post: 10th January 2010, 16:53
  2. Replies: 7
    Last Post: 3rd December 2009, 16:23
  3. How to read only a certain amount of bytes
    By Morea in forum Qt Programming
    Replies: 1
    Last Post: 28th January 2009, 07:38
  4. amount of items in QTreeWidget
    By supergillis in forum Qt Programming
    Replies: 4
    Last Post: 1st August 2008, 22:38
  5. finding the time interval of executing a program
    By babu198649 in forum Qt Programming
    Replies: 1
    Last Post: 13th December 2007, 12:05

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.