I need to set up a loop that increments a date between a startdate and enddate (both QDate variables). When I increment the loop variable dd using dd.addYears(1), dd does not change, hence the while loop runs for ever.
Why does the code below
Qt Code:
  1. QDate dd;
  2. dd= startdate ( a QDate variable)
  3. while ( dd < enddate ) {
  4. returnvalue = returnvalue + m_amount;
  5. dd.addYears(1);
  6. qstr.clear();
  7. QTextStream(&qstr) << "Weekday transaction of value " << returnvalue <<
  8. " on " << dd.toString();
  9. DebugMessage(qstr); // echos qstr to a log file
  10. }
To copy to clipboard, switch view to plain text mode 
Give the following output for qstr;

Weekday transaction of value 1 on Wed Feb 25 2009
Weekday transaction of value 2 on Wed Feb 25 2009
Weekday transaction of value 3 on Wed Feb 25 2009
Weekday transaction of value 4 on Wed Feb 25 2009
Weekday transaction of value 5 on Wed Feb 25 2009
Weekday transaction of value 6 on Wed Feb 25 2009
Weekday transaction of value 7 on Wed Feb 25 2009
Weekday transaction of value 8 on Wed Feb 25 2009

Have I just done something stupid