Results 1 to 4 of 4

Thread: qprogressbar without knowing the time

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2007
    Location
    Brazil
    Posts
    61
    Thanks
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default qprogressbar without knowing the time

    In post QProgress Bar-Time Measuring is used a known time. How do I do if I do not know the time?
    I have a program that read a file with many lines. This program takes the first line and test whether it is equal to some other line of the file. Take the next does the same thing to the end. But the program hangs and only responds when you finish the test.
    I would like a QProgressBar controlling it. But I have no idea.
    Someone help me? Thanks.
    Qt Code:
    1. while (!in.atEnd()) {
    2. novo:
    3. line = in.readLine();
    4. next = in.pos();
    5. test.clear();
    6.  
    7. test = line.split(QRegExp("\\s+"));
    8. zero = test[2].toFloat(&ok);
    9. zero2 = test[3].toFloat(&ok2);
    10.  
    11. if(!ok || !ok2 || zero == 0.0 || zero2 == 0.0 || test.size() <= 3){
    12.  
    13. if(in.atEnd()){
    14. continue;
    15. }else {
    16. goto novo;
    17. }
    18. }else {
    19.  
    20. junto = test[2] + test[3];
    21.  
    22. while (!in.atEnd()) {
    23. line = in.readLine();
    24. comp.clear();
    25. comp = line.split(QRegExp("\\s+"));
    26. zero = comp[2].toFloat(&ok);
    27. zero2 = comp[3].toFloat(&ok2);
    28.  
    29. if (!ok || !ok2 || zero == 0.0 || zero2 == 0.0 || comp.size() <= 3){
    30. //relout << comp.size() << "Comp " << comp[3] << endl;
    31. if (varrer.atEnd())
    32. break;
    33. else
    34. continue;
    35. }else if (junto == comp[2]+comp[3]){
    36. relout << "Equal: Line " << comp[2] << " PT " << comp[3] << endl;
    37. file.close();
    38. break;
    39. //return;
    40. }
    41. }
    42. in.seek(next);
    43. }
    44. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by jaca; 24th September 2009 at 02:06.

Similar Threads

  1. How to constantly refresh time on a view
    By salmanmanekia in forum Qt Programming
    Replies: 5
    Last Post: 23rd June 2008, 12:44
  2. file time stamp preservation
    By baray98 in forum Qt Programming
    Replies: 0
    Last Post: 8th April 2008, 00:13
  3. Replies: 1
    Last Post: 1st February 2008, 18:55
  4. QDateTime GMT add sec. or - sec. from locale time....
    By patrik08 in forum Qt Programming
    Replies: 2
    Last Post: 20th February 2007, 16:39
  5. Problem with pointers while using localtime() and time()
    By jamadagni in forum General Programming
    Replies: 7
    Last Post: 11th January 2006, 15:48

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.