00001 #ifndef GRAPHER_H 00002 #define GRAPHER_H 00003 00004 #define DEBUG_MODELSPEED 00005 #undef DEBUG_MODELSPEED 00006 00007 #include <qwt_data.h> 00008 00009 class QAbstractItemModel; 00010 00014 class PlotDataModel : public QwtData { 00015 public: 00016 PlotDataModel(QAbstractItemModel *model, int xColumn, int yColumn); 00017 void initialize(); 00018 size_t size() const; 00019 double x(size_t i) const; 00020 double y(size_t i) const; 00021 QwtData *copy() const ; 00022 00023 private: 00024 void setModel(QAbstractItemModel *model, int xColumn, int yColumn); 00025 QAbstractItemModel *model() const; 00026 00027 private: 00028 QAbstractItemModel *sourceModel; 00029 int xColumn; 00030 int yColumn; 00031 }; 00032 00033 #include <QWidget> 00034 00035 class PlotCurve; 00036 class PlotWidget; 00037 class BaseQueryModel; 00038 00051 class Grapher : public QWidget 00052 { Q_OBJECT 00053 public: 00054 Grapher(BaseQueryModel *base, QWidget *parent = 0); 00055 00056 private: 00057 BaseQueryModel *base; 00058 PlotWidget* plotWidget; 00059 00060 public slots: 00061 void addCurve(PlotCurve *curve); 00062 void removeCurve(PlotCurve* curve); 00063 void removeCurve(int logicalIndex); 00064 00065 private slots: 00066 #ifdef DEBUG_MODELSPEED 00067 void testQuerySpeed(); 00068 #endif //DEBUG_MODELSPEED 00069 }; 00070 00071 #endif // GRAPHER_H