QFrame error when subclassing QwtPlot
Hi,
I was making a simple subclass of QwtPlot but Iḿ ot able to compile it. Every time I try, I get this error:
Quote:
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:
Code:
#include <qwt_plot.h>
{
Q_OBJECT
public:
private:
void alignScales();
void getDataPlot();
double equis[2000];
double ye1[2000];
double ye2[2000];
};
And here's the code from the vectplot.cpp file:
Code:
#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);
}
}
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
Re: QFrame error when subclassing QwtPlot
I don't know what is the problem but I can suggest 2 ways :
- I implemented a subclass of QwtPlot and my code is similar to yours. One difference is that I don't have any Qwidget parent parameter in the constructor and so, I don't call QwtPlot (at least explicitely). I have something similar to
# Vectplot::Vectplot() {
....
}
- If it does not work, I suggest to try to implement a copy constructor for your class. It solved some similar compilations error on my project. However, I don't see any call to a copy constructor in your code so I don't think this is the problem.
Joel.