qwt_plot_rescaler.h
Go to the documentation of this file.
1 /******************************************************************************
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
12 
13 #include "qwt_global.h"
14 #include "qwt_plot.h"
15 
16 #include <qobject.h>
17 
18 class QwtPlot;
19 class QwtInterval;
20 class QResizeEvent;
21 
29 class QWT_EXPORT QwtPlotRescaler : public QObject
30 {
31  Q_OBJECT
32 
33  public:
41  {
48 
58 
63  Fitting
64  };
65 
71  {
74 
77 
79  ExpandBoth
80  };
81 
82  explicit QwtPlotRescaler( QWidget* canvas,
83  QwtAxisId referenceAxis = QwtAxis::XBottom,
84  RescalePolicy = Expanding );
85 
86  virtual ~QwtPlotRescaler();
87 
88  void setEnabled( bool );
89  bool isEnabled() const;
90 
91  void setRescalePolicy( RescalePolicy );
92  RescalePolicy rescalePolicy() const;
93 
94  void setExpandingDirection( ExpandingDirection );
95  void setExpandingDirection( QwtAxisId, ExpandingDirection );
96  ExpandingDirection expandingDirection( QwtAxisId ) const;
97 
98  void setReferenceAxis( QwtAxisId );
99  QwtAxisId referenceAxis() const;
100 
101  void setAspectRatio( double ratio );
102  void setAspectRatio( QwtAxisId, double ratio );
103  double aspectRatio( QwtAxisId ) const;
104 
105  void setIntervalHint( QwtAxisId, const QwtInterval& );
106  QwtInterval intervalHint( QwtAxisId ) const;
107 
108  QWidget* canvas();
109  const QWidget* canvas() const;
110 
111  QwtPlot* plot();
112  const QwtPlot* plot() const;
113 
114  virtual bool eventFilter( QObject*, QEvent* ) QWT_OVERRIDE;
115 
116  void rescale() const;
117 
118  protected:
119  virtual void canvasResizeEvent( QResizeEvent* );
120 
121  virtual void rescale( const QSize& oldSize, const QSize& newSize ) const;
122  virtual QwtInterval expandScale(
123  QwtAxisId, const QSize& oldSize, const QSize& newSize ) const;
124 
125  virtual QwtInterval syncScale(
126  QwtAxisId, const QwtInterval& reference, const QSize& size ) const;
127 
128  virtual void updateScales(
129  QwtInterval intervals[QwtAxis::AxisPositions] ) const;
130 
131  Qt::Orientation orientation( QwtAxisId ) const;
132  QwtInterval interval( QwtAxisId ) const;
133  QwtInterval expandInterval( const QwtInterval&,
134  double width, ExpandingDirection ) const;
135 
136  private:
137  double pixelDist( QwtAxisId, const QSize& ) const;
138 
139  class AxisData;
140  class PrivateData;
142 };
143 
144 #endif
sol::reference
basic_reference< false > reference
Definition: forward.hpp:1100
QwtPlotRescaler::ExpandDown
@ ExpandDown
The lower limit of the scale is adjusted.
Definition: qwt_plot_rescaler.h:76
QwtPlot
A 2-D plotting widget.
Definition: qwt_plot.h:78
qwt_global.h
nonstd::span_lite::size
span_constexpr std::size_t size(span< T, Extent > const &spn)
Definition: span.hpp:1554
QwtPlotRescaler::RescalePolicy
RescalePolicy
Definition: qwt_plot_rescaler.h:40
QwtInterval
A class representing an interval.
Definition: qwt_interval.h:22
QwtPlotRescaler
QwtPlotRescaler takes care of fixed aspect ratios for plot scales.
Definition: qwt_plot_rescaler.h:29
QwtAxisId
int QwtAxisId
Axis identifier.
Definition: qwt_axis_id.h:26
QwtPlotRescaler::ExpandUp
@ ExpandUp
The upper limit of the scale is adjusted.
Definition: qwt_plot_rescaler.h:73
QwtPlotRescaler::m_data
PrivateData * m_data
Definition: qwt_plot_rescaler.h:140
QwtPlotRescaler::ExpandingDirection
ExpandingDirection
Definition: qwt_plot_rescaler.h:70
QwtAxis::AxisPositions
@ AxisPositions
Definition: qwt_axis.h:44
QwtPlotRescaler::PrivateData
Definition: qwt_plot_rescaler.cpp:33
QwtPlotRescaler::Fixed
@ Fixed
Definition: qwt_plot_rescaler.h:47
QWT_OVERRIDE
#define QWT_OVERRIDE
Definition: qwt_global.h:53
QWT_EXPORT
#define QWT_EXPORT
Definition: qwt_global.h:38
QwtPlotRescaler::Expanding
@ Expanding
Definition: qwt_plot_rescaler.h:57
qwt_plot.h
QwtAxis::XBottom
@ XBottom
X axis below the canvas.
Definition: qwt_axis.h:44


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:46