Qwt User's Guide: qwt_plot_rescaler.h Source File

Qwt User's Guide 6.1.3

- Main Page
- Classes

qwt_plot_rescaler.h
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:
37 enum RescalePolicy
38 {
44 Fixed,
45
54 Expanding,
55
60 Fitting
61 };
62
67 enum ExpandingDirection
68 {
70 ExpandUp,
71
73 ExpandDown,
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;
139 PrivateData *d_data;
140 };
141
142 #endif
QwtPlotRescaler::ExpandUp
The upper limit of the scale is adjusted.
Definition: qwt_plot_rescaler.h:70
QwtPlot::axisCnt
Number of axes.
Definition: qwt_plot.h:108
QwtPlotRescaler::Expanding
Definition: qwt_plot_rescaler.h:54
QwtPlotRescaler::Fixed
Definition: qwt_plot_rescaler.h:44
QwtPlot::xBottom
X axis below the canvas.
Definition: qwt_plot.h:102
QwtPlotRescaler::RescalePolicy
RescalePolicy
Definition: qwt_plot_rescaler.h:37
QwtPlotRescaler::ExpandingDirection
ExpandingDirection
Definition: qwt_plot_rescaler.h:67
QwtPlotRescaler
QwtPlotRescaler takes care of fixed aspect ratios for plot scales.
Definition: qwt_plot_rescaler.h:28
QwtPlotRescaler::ExpandDown
The lower limit of the scale is adjusted.
Definition: qwt_plot_rescaler.h:73
QwtInterval
A class representing an interval.
Definition: qwt_interval.h:26
QwtPlot
A 2-D plotting widget.
Definition: qwt_plot.h:74