gpt4 book ai didi

c++ - 预期类型说明符位于 'QwtLog10ScaleEngine' 之前?

转载 作者:行者123 更新时间:2023-11-30 17:31:32 29 4
gpt4 key购买 nike

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

问题:数据未绘制,因此绘图为空,编译器返回以下错误:“‘QwtLog10ScaleEngine’之前预期类型说明符”任何帮助将不胜感激这是我的代码:

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 的类。

关于c++ - 预期类型说明符位于 'QwtLog10ScaleEngine' 之前?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24567737/

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