本文介绍了'QwtLog10ScaleEngine' 之前的预期类型说明符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

版本:qwt 6.0.1我尝试为 Spectrum 开发对数缩放.我使用简单的线来启用缩放 plotspectrum->setAxisScaleEngine(QwtPlot::yLeft, new QwtLog10ScaleEngine);

Version: qwt 6.0.1I've tried to develop logarithmic scaling for Spectrum.I've used simple line to enable scaling plotspectrum->setAxisScaleEngine(QwtPlot::yLeft, new QwtLog10ScaleEngine);

问题:数据没有绘制,所以绘图为空,编译器返回以下错误:预期类型说明符在'QwtLog10ScaleEngine'之前"任何帮助将不胜感激这是我的代码:

Problems: the data are not drawn, so the plot is empty and the compiler returns following error:"expected type-specifier before 'QwtLog10ScaleEngine'"Any help woulb be appreciatedHere is my code:

class SpectrumPlot : public QWidget
{
Q_OBJECT
public:
PlotSpektrum();
private:
QHBoxLayout*    m_SpectrumLayout;
QwtPlot*        m_SpectrumPlot;
QwtPlotCurve*   m_SpectrumCurve;
QwtPlotMarker*  m_Marker;

};

SpectrumPlot::SpectrumPlot()
{
m_SpectrumLayout = new QHBoxLayout();
m_SpectrumPlot = new QwtPlot();
m_SpectrumCurve = new QwtPlotCurve();
QwPlotGrid* pGrid = new QwtPlotGrid();
QPen GridPen;
GridPen.setColor(Qt::green);
GridPen.setWidthF(0.7);
GridPen.setStyle(Qt::DashLine);
QPen SpectrumPen;
SpectrumPen.setColor(Qt::white);

pGrid->setRenderHint(QwtPlotItem::RenderAntialiased);
pGrid->setPen(GridPen);
pGrid->enableXMin(true);
pGrid->attach(m_SpectrumPlot);
m_SpectrumPlot->setTitle("Spectrum");
m_SpectrumPlot->setCanvasBackground(QBrush(Qt::black));
m_SpectrumPlot->setAutoDelete(true);
m_SpectrumPlot->setAxisTitle(QwtPlot::xBottom, "Frequency Hz");
m_SpectrumPlot->setAxisScale(QwtPlot::xBottom, 100, nNyquistFrequency);
m_SpectrumPlot->setAxisScale(QwtPlot::yLeft, 0, 150);
m_SpectrumPlot->setAxisScaleEngine(QwtPlot::xBottom, new QwtLog10ScaleEngine());
m_SpectrumLayout->addWidget(m_SpectrumPlot);

this->setLayout(m_SpectrumLayout);
}

推荐答案

我认为你应该使用:

new QwtLogScaleEngine(10)

QwtScaleEngine 的手册没有显示任何称为QwtLog10ScaleEngine.

这篇关于'QwtLog10ScaleEngine' 之前的预期类型说明符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-27 19:59