qwt_plot_rescaler.h
Go to the documentation of this file.
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2  * Qwt Widget Library
3  * Copyright (C) 1997 Josef Wilgen
4  * Copyright (C) 2002 Uwe Rathmann
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the Qwt License, Version 1.0
8  *****************************************************************************/
9 
10 #ifndef QWT_PLOT_RESCALER_H
11 #define QWT_PLOT_RESCALER_H 1
12 
13 #include "qwt_global.h"
14 #include "qwt_interval.h"
15 #include "qwt_plot.h"
16 #include <qobject.h>
17 
18 class QwtPlot;
19 class QResizeEvent;
20 
28 class QWT_EXPORT QwtPlotRescaler: public QObject
29 {
30 public:
38  {
45 
55 
60  Fitting
61  };
62 
68  {
71 
74 
76  ExpandBoth
77  };
78 
79  explicit QwtPlotRescaler( QWidget *canvas,
80  int referenceAxis = QwtPlot::xBottom,
81  RescalePolicy = Expanding );
82 
83  virtual ~QwtPlotRescaler();
84 
85  void setEnabled( bool );
86  bool isEnabled() const;
87 
88  void setRescalePolicy( RescalePolicy );
89  RescalePolicy rescalePolicy() const;
90 
91  void setExpandingDirection( ExpandingDirection );
92  void setExpandingDirection( int axis, ExpandingDirection );
93  ExpandingDirection expandingDirection( int axis ) const;
94 
95  void setReferenceAxis( int axis );
96  int referenceAxis() const;
97 
98  void setAspectRatio( double ratio );
99  void setAspectRatio( int axis, double ratio );
100  double aspectRatio( int axis ) const;
101 
102  void setIntervalHint( int axis, const QwtInterval& );
103  QwtInterval intervalHint( int axis ) const;
104 
105  QWidget *canvas();
106  const QWidget *canvas() const;
107 
108  QwtPlot *plot();
109  const QwtPlot *plot() const;
110 
111  virtual bool eventFilter( QObject *, QEvent * );
112 
113  void rescale() const;
114 
115 protected:
116  virtual void canvasResizeEvent( QResizeEvent * );
117 
118  virtual void rescale( const QSize &oldSize, const QSize &newSize ) const;
119  virtual QwtInterval expandScale(
120  int axis, const QSize &oldSize, const QSize &newSize ) const;
121 
122  virtual QwtInterval syncScale(
123  int axis, const QwtInterval& reference,
124  const QSize &size ) const;
125 
126  virtual void updateScales(
127  QwtInterval intervals[QwtPlot::axisCnt] ) const;
128 
129  Qt::Orientation orientation( int axis ) const;
130  QwtInterval interval( int axis ) const;
131  QwtInterval expandInterval( const QwtInterval &,
132  double width, ExpandingDirection ) const;
133 
134 private:
135  double pixelDist( int axis, const QSize & ) const;
136 
137  class AxisData;
138  class PrivateData;
140 };
141 
142 #endif
A class representing an interval.
Definition: qwt_interval.h:26
Number of axes.
Definition: qwt_plot.h:108
#define QWT_EXPORT
Definition: qwt_global.h:38
A 2-D plotting widget.
Definition: qwt_plot.h:74
The lower limit of the scale is adjusted.
PrivateData * d_data
QwtPlotRescaler takes care of fixed aspect ratios for plot scales.
The upper limit of the scale is adjusted.
X axis below the canvas.
Definition: qwt_plot.h:102


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:17