Expected type-specifier before 'QwtLog10ScaleE

2020-05-09 11:45发布

Version: qwt 6.0.1 I've tried to develop logarithmic scaling for Spectrum. I've used simple line to enable scaling plotspectrum->setAxisScaleEngine(QwtPlot::yLeft, new 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 appreciated Here 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);
}

标签: c++ c qt plot qwt
1条回答
狗以群分
2楼-- · 2020-05-09 12:27

I think you should be using:

new QwtLogScaleEngine(10)

The manual for QwtScaleEngine doesn't show any classes called QwtLog10ScaleEngine.

查看更多
登录 后发表回答