PDA

View Full Version : expected type-specifier before 'QwtLog10ScaleEngine'



Bangalaman
4th July 2014, 07:04
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);
}

Uwe
4th July 2014, 09:49
#include <qwt_scale_engine.h>Uwe

Bangalaman
4th July 2014, 12:26
Uwe! I've already included< qwt_scale_engine.h>
I have and I've had the same error

Added after 7 minutes:

here is my header
#include "kiss_fft.h"
#include "kiss_fftr.h"

#include <QSharedPointer>
#include <QWidget>
#include <QHBoxLayout>
#include <QVector>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_grid.h>
#include <qwt_scale_engine.h>
#include <qwt_plot_marker.h>

Uwe
4th July 2014, 12:27
Well - at least in Qwt 6.1 - the name of the class is QwtLogScaleEngine.

Uwe

Bangalaman
4th July 2014, 14:57
Thank you for reply and help . it works fine now . my mystake was the Qwt's version , I already use Qwt 6.1 not 6.0.1, I've changed QwtLog10ScaleEngine to QwtLogScaleEngine