gpt4 book ai didi

c++ - 如何在 QwtPlot 上给 QwtPlotCurve 添加标签?

转载 作者:行者123 更新时间:2023-11-28 06:16:55 25 4
gpt4 key购买 nike

如何在 QwtPlot 上给 QwtPlotCurve 添加标签? enter image description here

例子

最佳答案

我的解决方案

class QwtPlotCurveWithTitle : public QwtPlotCurve{
public:
explicit QwtPlotCurveWithTitle( const QString &title = QString::null ) : QwtPlotCurve(title){}
explicit QwtPlotCurveWithTitle( const QwtText &title ) : QwtPlotCurve(title){}
protected:
virtual void drawCurve( QPainter *p, int style,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &canvasRect, int from, int to ) const{
QwtPlotCurve::drawCurve(p,style,xMap,yMap,canvasRect,from,to);
QPointF point = sample(from);
p->drawText(xMap.transform(point.x()),yMap.transform(point.y()),title().text());
}
};

关于c++ - 如何在 QwtPlot 上给 QwtPlotCurve 添加标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30094441/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com