98 w->installEventFilter(
this );
100 w->removeEventFilter(
this );
273 return qobject_cast<QWidget *>( parent() );
279 return qobject_cast<
const QWidget *>( parent() );
287 w = w->parentWidget();
289 return qobject_cast<
QwtPlot *>( w );
295 const QWidget *w =
canvas();
297 w = w->parentWidget();
299 return qobject_cast<
const QwtPlot *>( w );
305 if (
object &&
object ==
canvas() )
307 switch ( event->type() )
314 case QEvent::PolishRequest:
334 const QMargins m =
canvas()->contentsMargins();
335 const QSize marginSize( m.left() + m.right(), m.top() + m.bottom() );
337 const QSize newSize =
event->size() - marginSize;
338 const QSize oldSize =
event->oldSize() - marginSize;
346 const QSize size =
canvas()->contentsRect().size();
357 const QSize &oldSize,
const QSize &newSize )
const 359 if ( newSize.isEmpty() )
367 intervals[refAxis] =
expandScale( refAxis, oldSize, newSize );
371 if (
aspectRatio( axis ) > 0.0 && axis != refAxis )
372 intervals[axis] =
syncScale( axis, intervals[refAxis], newSize );
388 const QSize &oldSize,
const QSize &newSize )
const 401 if ( !oldSize.isEmpty() )
403 double width = oldInterval.
width();
405 width *= double( newSize.width() ) / oldSize.width();
407 width *= double( newSize.height() ) / oldSize.height();
427 width = newSize.width() * dist;
429 width = newSize.height() * dist;
455 dist = reference.
width() / size.width();
457 dist = reference.
width() / size.height();
460 dist *= size.width();
462 dist *= size.height();
486 return Qt::Horizontal;
531 interval.
width() / 2.0 - width / 2.0 );
550 dist = intv.
width() * r;
557 dist /= size.width();
559 dist /= size.height();
587 double v1 = intervals[axis].minValue();
588 double v2 = intervals[axis].maxValue();
613 bool immediatePaint =
false;
626 if ( canvas && immediatePaint )
633 #include "moc_qwt_plot_rescaler.cpp" const QwtScaleDiv & axisScaleDiv(int axisId) const
Return the scale division of a specified axis.
void setRescalePolicy(RescalePolicy)
QwtInterval normalized() const
Normalize the limits of the interval.
A class representing an interval.
virtual void canvasResizeEvent(QResizeEvent *)
void setReferenceAxis(int axis)
QwtInterval interval(int axis) const
QwtInterval expandInterval(const QwtInterval &, double width, ExpandingDirection) const
void setAutoReplot(bool=true)
Set or reset the autoReplot option.
Y axis right of the canvas.
virtual void replot()
Redraw the plot.
double aspectRatio(int axis) const
A class representing a scale division.
bool testPaintAttribute(PaintAttribute) const
Y axis left of the canvas.
int referenceAxis() const
virtual QwtInterval expandScale(int axis, const QSize &oldSize, const QSize &newSize) const
void setAxisScaleDiv(int axisId, const QwtScaleDiv &)
Disable autoscaling and specify a fixed scale for a selected axis.
QwtPlotRescaler::AxisData axisData[QwtPlot::axisCnt]
QwtPlotRescaler(QWidget *canvas, int referenceAxis=QwtPlot::xBottom, RescalePolicy=Expanding)
QwtInterval intervalHint(int axis) const
The lower limit of the scale is adjusted.
void setExpandingDirection(ExpandingDirection)
void setEnabled(bool)
En/disable the rescaler.
Both limits of the scale are adjusted.
virtual ~QwtPlotRescaler()
Destructor.
basic_reference< false > reference
void rescale() const
Adjust the plot axes scales.
QwtPlotRescaler takes care of fixed aspect ratios for plot scales.
RescalePolicy rescalePolicy
void setPaintAttribute(PaintAttribute, bool on=true)
Changing the paint attributes.
Number of valid tick types.
void setAxisScale(int axisId, double min, double max, double stepSize=0)
Disable autoscaling and specify a fixed scale for a selected axis.
ExpandingDirection expandingDirection(int axis) const
bool isIncreasing() const
Check if the scale division is increasing( lowerBound() <= upperBound() )
QwtPlotRescaler::ExpandingDirection expandingDirection
Qt::Orientation orientation(int axis) const
The upper limit of the scale is adjusted.
void setAspectRatio(double ratio)
QwtInterval interval() const
virtual void updateScales(QwtInterval intervals[QwtPlot::axisCnt]) const
double width() const
Return the width of an interval.
QList< double > ticks(int tickType) const
double pixelDist(int axis, const QSize &) const
virtual QwtInterval syncScale(int axis, const QwtInterval &reference, const QSize &size) const
virtual bool eventFilter(QObject *, QEvent *) QWT_OVERRIDE
Event filter for the plot canvas.
RescalePolicy rescalePolicy() const
void setIntervalHint(int axis, const QwtInterval &)