C++ qwt setPen过载不起作用
我想编译以下代码:C++ qwt setPen过载不起作用,c++,qt,qwt,C++,Qt,Qwt,我想编译以下代码: #include <QApplication> #include <qwt_plot.h> #include <qwt_plot_curve.h> #include <qwt_plot_grid.h> #include <qwt_symbol.h> #include <qwt_legend.h> int main(int argc, char *argv[]) { QApplication a(
#include <QApplication>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_grid.h>
#include <qwt_symbol.h>
#include <qwt_legend.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QwtPlot plot;
plot.setTitle( "Plot Demo" );
plot.setCanvasBackground( Qt::white );
plot.setAxisScale( QwtPlot::yLeft, 0.0, 10.0);
plot.insertLegend( new QwtLegend() );
QwtPlotGrid *grid = new QwtPlotGrid();
grid->attach( &plot );
QwtPlotCurve *curve = new QwtPlotCurve();
curve->setTitle( "Pixel Count" );
curve->setPen( Qt::blue, 4 ),
curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
QwtSymbol *symbol = new QwtSymbol( QwtSymbol::Ellipse,
QBrush( Qt::yellow ), QPen( Qt::red, 2 ), QSize( 8, 8 ) );
curve->setSymbol( symbol );
QPolygonF points;
points << QPointF( 0.0, 4.4 ) << QPointF( 1.0, 3.0 )
<< QPointF( 2.0, 4.5 ) << QPointF( 3.0, 6.8 )
<< QPointF( 4.0, 7.9 ) << QPointF( 5.0, 7.1 );
curve->setSamples( points );
curve->attach( &plot );
plot.resize( 600, 400 );
plot.show();
return a.exec();
}
#包括
#包括
#包括
#包括
#包括
#包括
int main(int argc,char*argv[])
{
质量保证申请a(argc、argv);
qwt图;
绘图。设置标题(“绘图演示”);
plot.setCanvasBackground(Qt::白色);
plot.setAxisScale(QwtPlot::yLeft,0.0,10.0);
plot.insertLegend(新的QwtLegend());
QwtPlotGrid*grid=新的QwtPlotGrid();
网格->附着(&plot);
QwtPlotCurve*曲线=新的QwtPlotCurve();
曲线->设置标题(“像素计数”);
曲线->设置笔(Qt::蓝色,4),
曲线->SetRenderInt(QwtPlotItem::RenderAnialized,true);
QwtSymbol*symbol=新的QwtSymbol(QwtSymbol::椭圆,
QBrush(Qt::黄色)、QPen(Qt::红色,2)、QSize(8,8));
曲线->设置符号(符号);
QPolygonF点;
points是curve->setPen(Qt::blue,4)后面的逗号,
一个输入错误?它应该是结尾的“;”。是的,那是一个输入错误,我已经纠正了,但没有在剪贴板中更改代码…你试着调用curve->setPen(Qt::blue,4.0,Qt::SolidLine)了吗
?是否包含正确版本的#include
文件?提到的API是针对Qwt 6.1.1的。在我只安装了Qwt-6.1.1之后,我认为这应该是正确的API(或者我如何检查是否安装了多个版本的Qwt?)