Something like this:
{
public:
void setText
( const QString &text
) {
m_text = text;
}
const QRectF &canvasRect
) const {
painter->drawText( canvasRect, Qt::AlignCenter, m_text );
}
private:
};
class TextItem: public QwtPlotItem
{
public:
void setText( const QString &text )
{
m_text = text;
}
virtual void draw( QPainter *painter,
const QwtScaleMap &, const QwtScaleMap &,
const QRectF &canvasRect ) const
{
painter->drawText( canvasRect, Qt::AlignCenter, m_text );
}
private:
QString m_text;
};
To copy to clipboard, switch view to plain text mode
Attach this item to your plot like a curve and the draw method will be part of the plot image composition.
Uwe
Bookmarks