Hi I need some help.

I have a QwtScaleDraw class that puts the day, month, year hour:min:sec on the xaxis of my plot. I like having all of this info, but when I zoom in to look at a single day I want this label to only show the hour:min:sec. The problem is that I don't understand how qwtScaleDraw works. I modeled my class off of the QWT examples and have:

Qt Code:
  1. class XaxisDates: public QwtScaleDraw
  2. {
  3. public:
  4. XaxisDates(){
  5. setLabelRotation(-11.0);
  6. setSpacing(10);
  7. }
  8. virtual QwtText label(double value) const{
  9. time_t time = value;
  10. char *humanTime = ctime(&(time));
  11. return QString(humanTime); //output looks like: "fri Jan 1 08:30:15 2010"
  12. }
  13. };
To copy to clipboard, switch view to plain text mode 

because "virtual QwtText label(double value) const" is constant I cannot put the code that I want in it to check if the date now equals the previous date. This is what I want to do:

Qt Code:
  1. virtual QwtText label(double value) const{
  2. time_t time = value;
  3. char *humanTime = ctime(&(time));
  4.  
  5. QDateTime dt = QDateTime::fromTime_t(time);
  6. nowDate = dt.date(); //error here for redefining nowDate
  7.  
  8. if (nowDate == previousDate){
  9. previousDate = nowDate; //error here for redefining previousDate
  10. return dt.time()
  11. }else
  12. return QString(humantime);
  13. }
To copy to clipboard, switch view to plain text mode 

If I try to do this I get an error saying I cannot change the value of a constant.

I am new to computer programing and could use some help dealing with this const function. I tried to simply make "virtual QwtText label(double value) const" not const but that interferes with the way QwtScaleDraw works (i guess) because if I do that the function just never gets called. I also tried to call a function from within "virtual QwtText label(double value) const" but I get the error "cannot convert this pointer from const xaxisdates to xaxisdates &."


Any help would be greatly appreciated.
Thanks!