Yes, I moved the code from XRealTimeCurve and now I am saving legendItemName in XRealTimeCurve only.

Qt Code:
  1. class XRealTimeCurve : public QwtPlotCurve
  2. {
  3. public:
  4. void setLegendItemName( const QString& name );
  5.  
  6. QString legendItemName() const;
  7. private:
  8. QString legendItem;
  9. }
  10.  
  11. void XTrendViewer::updateCurveTitle( XTrendCurve* curve )
  12. {
  13. int dataSize = curve->dataSize();
  14. if ( dataSize == 0 )
  15. {
  16. curve->setTitle( curve->legendItemName() );
  17. return;
  18. }
  19.  
  20. QPointF currentPoint = curve->sample( dataSize - 1 );
  21. QString legendItemValue = QString().setNum( currentPoint.y(), 'f', 2 );
  22.  
  23. QFontMetrics fontMetrics( QwtText().font() );
  24.  
  25. int maxWidth = fontMetrics.width( maxPenName ) + 10;
  26.  
  27. QString table = "<table> <tr> <td width="+ QString().setNum( maxWidth ) + ">" + curve->legendItemName() + "</td> <td width=50>" +
  28. legendItemValue + "</td> </tr> </table>";
  29.  
  30. curve->setTitle( QwtText( table, QwtText::RichText ) );
  31. }
To copy to clipboard, switch view to plain text mode 

I set title and legend item's text from external place in class XTrendViewer : public QwtPlot