Hi, I have reimplemented QwtScaleDraw.

When I start plotting data I would like the current time to be displayed. Not the time when the application started.

I reset my QTime, It does eventually display the right time after the plot starts to auto scale.

Thanks in advance
Brendan

Qt Code:
  1. class TimeScaleDraw: public QwtScaleDraw
  2. {
  3. public:
  4. TimeScaleDraw();
  5. void start();
  6. virtual QwtText label(double) const;
  7.  
  8. private:
  9. QTime m_base_time;
  10. };
  11.  
  12. TimeScaleDraw::TimeScaleDraw()
  13. {
  14. start();
  15. }
  16.  
  17. QwtText TimeScaleDraw::label(double v) const
  18. {
  19. QTime upTime = m_base_time.addMSecs((int)v);
  20.  
  21. return upTime.toString("H:mm:ss.zzz");
  22. }
  23.  
  24. void TimeScaleDraw::start()
  25. {
  26. m_base_time.start();
  27. //TODO: DO SOMETHING HERE TO REFRESH QwtScaleDraw???
  28. }
To copy to clipboard, switch view to plain text mode