【问题标题】:Expected type-specifier before 'QwtLog10ScaleEngine'?'QwtLog10ScaleEngine' 之前的预期类型说明符?
【发布时间】:2014-07-04 06:10:38
【问题描述】:

版本:qwt 6.0.1 我试图为 Spectrum 开发对数缩放。 我使用简单的线来启用缩放 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);
}

【问题讨论】:

  • 您是否包含了正确的头文件?
  • 是的,我已经包含了正确的标题

标签: c++ c qt plot qwt


【解决方案1】:

我认为你应该使用:

new QwtLogScaleEngine(10)

QwtScaleEngine 的手册没有显示任何名为 QwtLog10ScaleEngine 的类。

【讨论】:

  • 感谢您的回复。它现在工作正常。QwtLogScaleEngine 是 Qwt6.1 中类的新名称
猜你喜欢
  • 2012-02-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-04
  • 2014-06-08
  • 1970-01-01
相关资源
最近更新 更多