well, I am doing something definitely wrong, but I can't find it..
I followed the steps of "bode" example and created a class called my2dplot
In the constructor of the class I implemented everything, like axis titles, how to get data, attach curves, etc.
{
Q_OBJECT
public:
// int value() const;
public Q_SLOTS:
void setDamp(double damping);
public slots:
//general purpose functions
void gridOn(); //sets the grid on-off
double** getCurveData();//returns the data from file
//main spectroscopy curve functions
void attachData2Curve(double**);//attach data to main curve
void attachCurve2Plot();//attach main curve to plot widget
void plotMainCurve
(const QString &fileName
);
//function to call when you want to plot the main curve //it includes the call of the three previous functions
//getCurveData, attachData2Curve, attachCurve2Plot
int getDataSize(); //returns the size of the data
void setDataSize(int);//sets the data size
//Continuum Curve functions
void attachData2Continuum(double**);//attach data to Continuum curve
void attachContinuum2Plot();//attach Continuum curve to plot widget
void plotContinuumCurve
(QString &fileName
);
//function to call when you want to plot the Continuum curve
//set the data file name to read
//get the data file name to read
private slots:
signals:
private:
int dataSize;
};
class my2dPlot : public QwtPlot
{
Q_OBJECT
public:
my2dPlot(QWidget *parent = 0);
// int value() const;
public Q_SLOTS:
void setDamp(double damping);
public slots:
//general purpose functions
void gridOn(); //sets the grid on-off
double** getCurveData();//returns the data from file
//main spectroscopy curve functions
void attachData2Curve(double**);//attach data to main curve
void attachCurve2Plot();//attach main curve to plot widget
void plotMainCurve(const QString &fileName );//function to call when you want to plot the main curve
//it includes the call of the three previous functions
//getCurveData, attachData2Curve, attachCurve2Plot
int getDataSize(); //returns the size of the data
void setDataSize(int);//sets the data size
//Continuum Curve functions
void attachData2Continuum(double**);//attach data to Continuum curve
void attachContinuum2Plot();//attach Continuum curve to plot widget
void plotContinuumCurve(QString &fileName);//function to call when you want to plot the Continuum curve
//set the data file name to read
void setDataFile (QString);
//get the data file name to read
QString getDataFile ();
private slots:
signals:
private:
QwtPlot *myPlot;
QwtPlotGrid *grid;
QwtPlotCurve *mainCurve;
QwtPlotMarker *mainCurveMarker;
QwtPlotCurve *continuumCurve;
QwtPlotMarker *continuumCurveMarker;
QString dataFile;
int dataSize;
};
To copy to clipboard, switch view to plain text mode
Then I created a central widget including a member of my2dplot
class my2dPlot;
{
public:
my2dPlot *mainPlot;
protected:
private slots:
private Q_SLOTS:
#ifndef QT_NO_PRINTER
void print();
#endif
void exportDocument();
void enableZoomMode(bool);
signals:
private:
//my2dPlot *mainPlot;
};
class QwtPlotZoomer;
class QwtPlotPicker;
class QwtPlotPanner;
class my2dPlot;
class QPolygon;
class MyWidget : public QWidget
{
public:
MyWidget(QWidget *parent = 0);
my2dPlot *mainPlot;
protected:
private slots:
private Q_SLOTS:
void moved(const QPoint &);
void selected(const QPolygon &);
#ifndef QT_NO_PRINTER
void print();
#endif
void exportDocument();
void enableZoomMode(bool);
signals:
private:
//my2dPlot *mainPlot;
QPushButton *quitButton;
void showInfo(QString text = QString::null);
QwtPlotZoomer *d_zoomer[2];
QwtPlotPicker *d_picker;
QwtPlotPanner *d_panner;
};
To copy to clipboard, switch view to plain text mode
and then I set this widget as the mainWidget in the mainwindow.h
The problem is that in the main window a plot area appears (with no background color-grey) and it does not show ANYTHING of what is described in the constructor of my2dclass. How is this possible? I mean, how is it possible that the widget creates a qwt plot (actually a my2dplot plot) and it does not take into consideration the rest of the my2dclass constructor?
It must be something obvious, but I cannot really see it!
Bookmarks