Results 1 to 2 of 2

Thread: qwt plots & inheritance

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Posts
    142
    Thanks
    24
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default qwt plots & inheritance

    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.

    Qt Code:
    1. class my2dPlot : public QwtPlot
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. my2dPlot(QWidget *parent = 0);
    7. // int value() const;
    8. public Q_SLOTS:
    9. void setDamp(double damping);
    10. public slots:
    11. //general purpose functions
    12. void gridOn(); //sets the grid on-off
    13. double** getCurveData();//returns the data from file
    14.  
    15. //main spectroscopy curve functions
    16. void attachData2Curve(double**);//attach data to main curve
    17. void attachCurve2Plot();//attach main curve to plot widget
    18. void plotMainCurve(const QString &fileName );//function to call when you want to plot the main curve
    19. //it includes the call of the three previous functions
    20. //getCurveData, attachData2Curve, attachCurve2Plot
    21. int getDataSize(); //returns the size of the data
    22. void setDataSize(int);//sets the data size
    23.  
    24. //Continuum Curve functions
    25. void attachData2Continuum(double**);//attach data to Continuum curve
    26. void attachContinuum2Plot();//attach Continuum curve to plot widget
    27. void plotContinuumCurve(QString &fileName);//function to call when you want to plot the Continuum curve
    28.  
    29. //set the data file name to read
    30. void setDataFile (QString);
    31. //get the data file name to read
    32. QString getDataFile ();
    33. private slots:
    34.  
    35.  
    36. signals:
    37.  
    38. private:
    39. QwtPlot *myPlot;
    40. QwtPlotGrid *grid;
    41.  
    42. QwtPlotCurve *mainCurve;
    43. QwtPlotMarker *mainCurveMarker;
    44.  
    45. QwtPlotCurve *continuumCurve;
    46. QwtPlotMarker *continuumCurveMarker;
    47. QString dataFile;
    48. int dataSize;
    49.  
    50. };
    To copy to clipboard, switch view to plain text mode 

    Then I created a central widget including a member of my2dplot



    Qt Code:
    1. class my2dPlot;
    2. class QPolygon;
    3.  
    4.  
    5. class MyWidget : public QWidget
    6. {
    7. public:
    8. MyWidget(QWidget *parent = 0);
    9. my2dPlot *mainPlot;
    10.  
    11. protected:
    12.  
    13. private slots:
    14.  
    15. private Q_SLOTS:
    16. void moved(const QPoint &);
    17. void selected(const QPolygon &);
    18.  
    19. #ifndef QT_NO_PRINTER
    20. void print();
    21. #endif
    22. void exportDocument();
    23. void enableZoomMode(bool);
    24.  
    25. signals:
    26.  
    27.  
    28. private:
    29. //my2dPlot *mainPlot;
    30. QPushButton *quitButton;
    31.  
    32. void showInfo(QString text = QString::null);
    33. QwtPlotZoomer *d_zoomer[2];
    34. QwtPlotPicker *d_picker;
    35. QwtPlotPanner *d_panner;
    36. };
    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!
    Attached Images Attached Images

Similar Threads

  1. Plots and Layouts
    By Ozzy in forum Qwt
    Replies: 5
    Last Post: 17th November 2009, 09:00
  2. Reg multiple plots in Qwt
    By Tavit in forum Qwt
    Replies: 4
    Last Post: 23rd June 2008, 13:43
  3. Lining up multiple plots
    By joel in forum Qwt
    Replies: 2
    Last Post: 20th June 2008, 00:25
  4. selecting text in Qwt plots
    By kaustav98255 in forum Qwt
    Replies: 3
    Last Post: 12th May 2008, 08:11
  5. Replies: 4
    Last Post: 25th October 2007, 12:23

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.