qse  0.5.4
qsegraphcontroller.h
Go to the documentation of this file.
1 #ifndef QSEGRAPHCONTROLLER_H
2 #define QSEGRAPHCONTROLLER_H
3 
4 #include <QObject>
5 #include <QPen>
6 #include <QPoint>
7 #include <QList>
8 #include <QMap>
9 #include <qwt_symbol.h>
10 
11 class QAction;
12 class QseDataSet;
13 class QwtPlot;
14 class QTableView;
15 class QseGraphScansModel;
17 class QItemSelection;
18 class QItemSelectionModel;
19 class QwtPlotZoomer;
20 class QwtPlotPanner;
21 class QwtPlotMagnifier;
22 class QwtPlotItem;
23 class QwtLegend;
24 
25 typedef QwtSymbol *QwtSymbolPtr;
26 
27 #include "ui_qsegraphcontroller.h"
28 
29 class QseGraphController : public QWidget, public Ui::QseGraphController
30 {
31  Q_OBJECT;
32 
33  public:
34  QseGraphController(QseDataSet* ds, QWidget* parent=0);
35 
37 
38  public slots:
39  void printGraph();
40  void setAutoScale();
41  void showLegend();
42  void hideLegend();
43  void legendChecked(const QVariant &v, bool checked, int n);
44  void addContextMenuAction(QAction* action);
45  void setTitle(const QString& title);
46 
47  void columnsCellClicked(const QModelIndex& index);
48 
49  void saveSelectedScans();
50  void removeSelectedScans();
51 
52  void zoomGraphIn();
53  void zoomGraphOut();
54  void zoomGraphAll();
55 
56  public:
57  QseDataSet* dataSet() const;
58  int selectedColumnCount() const;
59  QString selectedColumn(int i) const;
60 
61  QList<int> selectedScans();
62  int scanCount();
63 
64  bool selectedPlotX(int i) const;
65  bool selectedPlotY(int i) const;
66  bool selectedPlotY2(int i) const;
67  bool selectedPlotNorm(int i) const;
68 
69  private slots:
70  void dataCleared();
71  void dataChanged();
72  void operationCompleted();
73  void scanAdded(int s);
75  (const QItemSelection& selected, const QItemSelection& deselected);
77  (const QItemSelection& selected, const QItemSelection& deselected);
78  void updateGraph();
79  void scansListContextMenu(const QPoint& pos);
80  void columnsTableContextMenu(const QPoint& pos);
81  void graphContextMenu(const QPoint& pos);
82 
83  private:
84  bool scanSelected(int i);
85  void toggleGraphSelection(int n, QSet<QString>& set);
86 
87  void enableAxes(bool y1, bool y2);
88 
89  void setAxisTitle(int axisId, const QSet<QString>& names);
90 
91  QwtSymbol *newSymbol(int n);
92 
93  private:
94  static const int MAX_CURVES = 500;
95 
96  static const int NPENS = 12;
97  QPen m_Pens[NPENS];
98 
99  static const int NSYMBOLS = 12;
100 // QwtSymbolPtr m_Symbols[NSYMBOLS];
101 
102  QList<QString> m_SelectedScanColumns;
103  QHash<QString,int> m_SelectedScanColumnCounts;
104 
105  QSet<QString> m_PlotXColumns;
106  QSet<QString> m_PlotYColumns;
107  QSet<QString> m_PlotY2Columns;
108  QSet<QString> m_PlotNormColumns;
109 
112  QItemSelectionModel *m_ScansSelection;
114  QItemSelectionModel *m_ColumnsSelection;
115 
116  QwtPlotZoomer *m_Zoomer;
117  QwtPlotZoomer *m_Zoomer2;
118  QwtPlotPanner *m_Panner;
119  QwtPlotMagnifier *m_Magnifier;
120  QwtLegend *m_Legend;
122  QList<QAction*> m_Actions;
123 
128 };
129 
130 #endif
static const int NPENS
QString selectedColumn(int i) const
QSet< QString > m_PlotYColumns
QwtSymbol * newSymbol(int n)
QHash< QString, int > m_SelectedScanColumnCounts
void setAxisTitle(int axisId, const QSet< QString > &names)
void scansSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
bool selectedPlotY(int i) const
QseGraphController(QseDataSet *ds, QWidget *parent=0)
QItemSelectionModel * m_ColumnsSelection
void toggleGraphSelection(int n, QSet< QString > &set)
QwtPlotPanner * m_Panner
bool selectedPlotX(int i) const
QseGraphScansModel * m_ScansModel
static const int MAX_CURVES
void graphContextMenu(const QPoint &pos)
QSet< QString > m_PlotXColumns
QList< int > selectedScans()
void columnsSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
void enableAxes(bool y1, bool y2)
QwtPlotZoomer * m_Zoomer2
void columnsCellClicked(const QModelIndex &index)
static const int NSYMBOLS
QList< QString > m_SelectedScanColumns
QwtSymbol * QwtSymbolPtr
QList< QAction * > m_Actions
void setTitle(const QString &title)
void addContextMenuAction(QAction *action)
void scansListContextMenu(const QPoint &pos)
void columnsTableContextMenu(const QPoint &pos)
QwtPlotMagnifier * m_Magnifier
QSet< QString > m_PlotNormColumns
void legendChecked(const QVariant &v, bool checked, int n)
QseGraphColumnsModel * m_ColumnsModel
QSet< QString > m_PlotY2Columns
int selectedColumnCount() const
bool selectedPlotY2(int i) const
bool selectedPlotNorm(int i) const
QItemSelectionModel * m_ScansSelection
QseDataSet * dataSet() const
QwtPlotZoomer * m_Zoomer