UltraScan III
us_plot.h
Go to the documentation of this file.
1 #ifndef US_PLOT_H
3 #define US_PLOT_H
4 
5 #include <QtGui>
6 
7 #include "qwt_plot.h"
8 #include "qwt_plot_grid.h"
9 #include "qwt_plot_picker.h"
10 #include "qwt_plot_panner.h"
11 #include "qwt_plot_zoomer.h"
12 #include "qwt_plot_curve.h"
13 #include "qwt_symbol.h"
14 
15 #include "us_widgets_dialog.h"
16 #include "us_extern.h"
17 
18 
20 
21 class US_Zoomer: public QwtPlotZoomer
22 {
23  public:
27  US_Zoomer( int, int, QwtPlotCanvas* );
28 };
29 
31 class US_PlotConfig;
32 
34 class US_PlotAxisConfig;
35 
37 class US_PlotGridConfig;
38 
40 class US_PlotCurveConfig;
41 
43 
46 class US_GUI_EXTERN US_Plot : public QHBoxLayout
47 {
48  Q_OBJECT
49 
50  public:
55 
56  US_Plot( QwtPlot*& plot, const QString&, const QString&, const QString& );
57 
59  QToolButton* btnZoom;
60 
61  signals:
63  void zoomedCorners( QwtDoubleRect );
64 
65  private:
67  QwtPlot* plot;
68 
69  QwtPlotZoomer* zoomer;
70  QwtPlotPicker* picker;
71  QwtPlotPanner* panner;
72 
73  private slots:
74  void zoom ( bool );
75  void print ( void );
76  void svg ( void );
77  void png ( void );
78  void config( void );
79 };
80 
83 class US_PlotPushbutton : public QPushButton
84 {
85  Q_OBJECT
86 
87  public:
91  US_PlotPushbutton( const QString&, QWidget*, int );
92 
93  signals:
96  void US_PlotPbPushed( int );
97 
98  private:
99  int pb_index;
100 
101  private slots:
102  void us_plotClicked( void );
103 };
104 
106 // via US_Plot
107 
109 {
110  Q_OBJECT
111 
112  public:
114  US_PlotConfig( QwtPlot*, QWidget* = 0, Qt::WindowFlags = 0 );
115 
116  //signals:
118  //void plotConfigClosed( void );
119 
120  private:
121  QwtPlot* plot;
122 
123  QLineEdit* le_titleText;
124  QLineEdit* le_titleFont;
125  QLineEdit* le_legendFont;
126 
129 
130  QComboBox* cmbb_legendPos;
131 
132  QListWidget* lw_curves;
133 
137 
138  void setLegendFontString( void );
139 
140  private slots:
141  void updateTitleText ( const QString& );
142  void updateTitleFont ( void );
143  void selectFrameColor ( void );
144  void selectCanvasColor( void );
145  void selectMargin ( int );
146  void selectLegendPos ( int );
147  void updateLegendFont ( void );
148  void updateAxis ( int );
149  void updateCurve ( void );
150  void updateGrid ( void );
151  //void axisConfigFinish ( void );
152  //void gridConfigFinish ( void );
153  //void curveConfigFinish( void );
154  //void closeEvent ( QCloseEvent* );
155 };
156 
157 class US_PlotLabel;
158 
160 
162 {
163  Q_OBJECT
164 
165  friend class US_PlotLabel;
166 
167  public:
168  US_PlotCurveConfig( QwtPlot*, const QStringList&, QWidget* = 0,
169  Qt::WindowFlags = 0 );
170 
171  //signals:
173  //void curveConfigClosed( void );
174 
175  private:
176  QwtPlot* plot;
177 
178  QStringList selectedItems;
179 
184 
185  QLineEdit* le_curveTitle;
186 
187  QSpinBox* sb_curveWidth;
188  QSpinBox* sb_symbolWidth;
189  QSpinBox* sb_symbolHeight;
190 
191  QComboBox* cmbb_curveStyle;
192  QComboBox* cmbb_symbolStyle;
193 
194  QwtPlotCurve* firstSelectedCurve;
195 
196  QwtPlotCurve::CurveStyle curveStyle;
197  QwtSymbol::Style symbolStyle;
198 
199  private slots:
200  //void closeEvent ( QCloseEvent* );
201  void curveStyleChanged ( int );
202  void updateSample ( int );
203  void selectCurveColor ( void );
204  void symbolStyleChanged ( int );
205  void selectSymbolInteriorColor( void );
206  void selectSymbolOutlineColor ( void );
207  void apply ( void );
208 };
209 
211 class US_PlotLabel : public QWidget
212 {
213  Q_OBJECT
214 
215  public:
220  US_PlotLabel( US_PlotCurveConfig*, QWidget* = 0, Qt::WindowFlags = 0 );
221 
222  private:
224  QLabel* label;
225 
226  private slots:
227  void paintEvent( QPaintEvent* );
228 };
229 
232 {
233  Q_OBJECT
234 
235  public:
236  US_PlotAxisConfig( int axis, QwtPlot*, QWidget* = 0, Qt::WindowFlags = 0 );
237 
238  //signals:
240  //void axisConfigClosed( void );
241 
242  private:
243  QwtPlot* plot;
244  int axis;
245 
246  QLineEdit* le_titleText;
247  QLineEdit* le_axisTitleFont;
248  QLineEdit* le_axisScaleFont;
249  QLineEdit* le_scaleFrom;
250  QLineEdit* le_scaleTo;
251  QLineEdit* le_scaleStep;
252  QLineEdit* le_reference;
253 
254  QRadioButton* rb_linear;
255  QRadioButton* rb_log;
256 
260 
261  QCheckBox* cb_present;
262  QCheckBox* cb_refValue;
263  QCheckBox* cb_symmetric;
264  QCheckBox* cb_floating;
265  QCheckBox* cb_inverted;
266  QCheckBox* cb_autoscale;
267 
270 
271  private slots:
272  //void closeEvent ( QCloseEvent* );
273  void selectTitleFont ( void );
274  void selectAxisTitleColor( void );
275  void selectScaleFont ( void );
276  void selectScaleColor ( void );
277  void selectTickColor ( void );
278  void apply ( void );
279 };
280 
283 {
284  Q_OBJECT
285 
286  public:
287  US_PlotGridConfig( QwtPlot*, QWidget* = 0, Qt::WindowFlags = 0 );
289 
290  //signals:
292  //void gridConfigClosed( void );
293 
294  private:
295  QwtPlot* plot;
296  QwtPlotGrid* grid;
297 
298  QCheckBox* cb_enableX;
299  QCheckBox* cb_enableY;
300  QCheckBox* cb_enableXminor;
301  QCheckBox* cb_enableYminor;
302 
305 
306  QComboBox* cmbb_majorStyle;
307  QComboBox* cmbb_minorStyle;
308 
309  QSpinBox* sb_majorWidth;
310  QSpinBox* sb_minorWidth;
311 
312  private slots:
313  void selectMajorColor( void );
314  void selectMinorColor( void );
315  void apply ( void );
316 };
317 
321 class US_GUI_EXTERN US_PlotPicker : public QwtPlotPicker
322 {
323  Q_OBJECT
324 
325  public:
326  US_PlotPicker( QwtPlot* );
327 
328  signals:
330  void mouseDown ( const QwtDoublePoint& );
332  void cMouseDown ( const QwtDoublePoint& );
334  void cMouseDownRaw( QMouseEvent* );
336  void mouseUp ( const QwtDoublePoint& );
338  void cMouseUp ( const QwtDoublePoint& );
340  void mouseDrag ( const QwtDoublePoint& );
342  void cMouseDrag ( const QwtDoublePoint& );
343 
344  protected:
346  void widgetMousePressEvent ( QMouseEvent* );
348  void widgetMouseReleaseEvent( QMouseEvent* );
350  void widgetMouseMoveEvent ( QMouseEvent* );
351 };
352 #endif
353