Hi,
I was making a simple subclass of QwtPlot but Iḿ ot able to compile it. Every time I try, I get this error:
In file included from vectplot.h:2,
from principal.h:10,
from principal.cpp:1:
/usr/include/qt4/QtGui/qframe.h: In copy constructor ‘QwtPlot::QwtPlot(const QwtPlot&)’:
/usr/include/qt4/QtGui/qframe.h:140: error: ‘QFrame::QFrame(const QFrame&)’ is private
/usr/local/qwt-5.2.0/include/qwt_plot.h:73: error: within this context
Here's the code from my vectplot.h file:
#include <qwt_plot.h>
{
Q_OBJECT
public:
private:
void alignScales();
void getDataPlot();
double equis[2000];
double ye1[2000];
double ye2[2000];
};
#include <qwt_plot.h>
class Vectplot: public QwtPlot
{
Q_OBJECT
public:
Vectplot(QWidget *parent = NULL);
private:
void alignScales();
void getDataPlot();
double equis[2000];
double ye1[2000];
double ye2[2000];
};
To copy to clipboard, switch view to plain text mode
And here's the code from the vectplot.cpp file:
#include "vectplot.h"
#include <math.h>
#include <qpainter.h>
#include <qwt_plot_curve.h>
#include <qwt_symbol.h>
#include <qwt_scale_widget.h>
#include <stdlib.h>
Vectplot
::Vectplot(QWidget *parent
):{
// We don't need the cache here
curve1->attach(this);
curve2->attach(this);
getDataPlot();
curve1->setData(equis, ye1, 2000);
curve2->setData(equis,ye2, 2000);
curve1
->setPen
(QPen(Qt
::red,
2));
curve2
->setPen
(QPen(Qt
::blue,
2));
replot();
}
void Vectplot::alignScales()
{
canvas()->setLineWidth(1);
for ( int i
= 0; i <
QwtPlot::axisCnt; i
++ ) {
if ( scaleWidget )
scaleWidget->setMargin(0);
if ( scaleDraw )
}
}
void Vectplot::getDataPlot()
{
for (int i = 0; i < 2000; i++)
{
ye1[i] = i / sqrt(i) ;
equis[i] = i ;
ye2[i] = sin(i);
}
}
#include "vectplot.h"
#include <math.h>
#include <qpainter.h>
#include <qwt_plot_curve.h>
#include <qwt_symbol.h>
#include <qwt_scale_widget.h>
#include <stdlib.h>
Vectplot::Vectplot(QWidget *parent):
QwtPlot(parent)
{
// We don't need the cache here
canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false);
canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false);
QwtPlotCurve *curve1 = new QwtPlotCurve("Curve 1");
QwtPlotCurve *curve2 = new QwtPlotCurve("Curve 2");
curve1->attach(this);
curve2->attach(this);
getDataPlot();
curve1->setData(equis, ye1, 2000);
curve2->setData(equis,ye2, 2000);
curve1->setPen(QPen(Qt::red, 2));
curve2->setPen(QPen(Qt::blue,2));
curve1->setStyle (QwtPlotCurve::Lines) ;
curve2->setStyle(QwtPlotCurve::Dots);
replot();
}
void Vectplot::alignScales()
{
canvas()->setFrameStyle(QFrame::Box | QFrame::Plain );
canvas()->setLineWidth(1);
for ( int i = 0; i < QwtPlot::axisCnt; i++ )
{
QwtScaleWidget *scaleWidget = (QwtScaleWidget *)axisWidget(i);
if ( scaleWidget )
scaleWidget->setMargin(0);
QwtScaleDraw *scaleDraw = (QwtScaleDraw *)axisScaleDraw(i);
if ( scaleDraw )
scaleDraw->enableComponent(QwtAbstractScaleDraw::Backbone, false);
}
}
void Vectplot::getDataPlot()
{
for (int i = 0; i < 2000; i++)
{
ye1[i] = i / sqrt(i) ;
equis[i] = i ;
ye2[i] = sin(i);
}
}
To copy to clipboard, switch view to plain text mode
I'm sure the error is something stupid, but haven't been able to find it. If someone could, please, check this and tell me what's going on, I'd appreciate it .
Thanks in advance,
Claudia
Bookmarks