| qwt_abstract_scale.h | | qwt_abstract_scale.h | |
| | | | |
| skipping to change at line 14 | | skipping to change at line 14 | |
| * Copyright (C) 2002 Uwe Rathmann | | * Copyright (C) 2002 Uwe Rathmann | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_ABSTRACT_SCALE_H | | #ifndef QWT_ABSTRACT_SCALE_H | |
| #define QWT_ABSTRACT_SCALE_H | | #define QWT_ABSTRACT_SCALE_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
|
| | | #include <qwidget.h> | |
| | | | |
| class QwtScaleEngine; | | class QwtScaleEngine; | |
| class QwtAbstractScaleDraw; | | class QwtAbstractScaleDraw; | |
| class QwtScaleDiv; | | class QwtScaleDiv; | |
| class QwtScaleMap; | | class QwtScaleMap; | |
| class QwtInterval; | | class QwtInterval; | |
| | | | |
| /*! | | /*! | |
|
| \brief An abstract base class for classes containing a scale | | \brief An abstract base class for widgets having a scale | |
| | | | |
|
| QwtAbstractScale is used to provide classes with a QwtScaleDraw, | | The scale of an QwtAbstractScale is determined by a QwtScaleDiv | |
| and a QwtScaleDiv. The QwtScaleDiv might be set explicitely | | definition, that contains the boundaries and the ticks of the scale. | |
| or calculated by a QwtScaleEngine. | | The scale is painted using a QwtScaleDraw object. | |
| | | | |
| | | The scale division might be assigned explicitly - but usually | |
| | | it is calculated from the boundaries using a QwtScaleEngine. | |
| | | | |
| | | The scale engine also decides the type of transformation of the scale | |
| | | ( linear, logarithmic ... ). | |
| */ | | */ | |
| | | | |
|
| class QWT_EXPORT QwtAbstractScale | | class QWT_EXPORT QwtAbstractScale: public QWidget | |
| { | | { | |
|
| | | Q_OBJECT | |
| | | | |
| | | Q_PROPERTY( double lowerBound READ lowerBound WRITE setLowerBound ) | |
| | | Q_PROPERTY( double upperBound READ upperBound WRITE setUpperBound ) | |
| | | | |
| | | Q_PROPERTY( int scaleMaxMajor READ scaleMaxMajor WRITE setScaleMaxMajor | |
| | | ) | |
| | | Q_PROPERTY( int scaleMaxMinor READ scaleMaxMinor WRITE setScaleMaxMinor | |
| | | ) | |
| | | | |
| | | Q_PROPERTY( double scaleStepSize READ scaleStepSize WRITE setScaleStepS | |
| | | ize ) | |
| | | | |
| public: | | public: | |
|
| QwtAbstractScale(); | | QwtAbstractScale( QWidget *parent = NULL ); | |
| virtual ~QwtAbstractScale(); | | virtual ~QwtAbstractScale(); | |
| | | | |
|
| void setScale( double vmin, double vmax, double step = 0.0 ); | | void setScale( double lowerBound, double upperBound ); | |
| void setScale( const QwtInterval &, double step = 0.0 ); | | void setScale( const QwtInterval & ); | |
| void setScale( const QwtScaleDiv & ); | | void setScale( const QwtScaleDiv & ); | |
| | | | |
|
| void setAutoScale(); | | const QwtScaleDiv& scaleDiv() const; | |
| bool autoScale() const; | | | |
| | | void setLowerBound( double value ); | |
| | | double lowerBound() const; | |
| | | | |
| | | void setUpperBound( double value ); | |
| | | double upperBound() const; | |
| | | | |
| | | void setScaleStepSize( double stepSize ); | |
| | | double scaleStepSize() const; | |
| | | | |
| void setScaleMaxMajor( int ticks ); | | void setScaleMaxMajor( int ticks ); | |
| int scaleMaxMinor() const; | | int scaleMaxMinor() const; | |
| | | | |
| void setScaleMaxMinor( int ticks ); | | void setScaleMaxMinor( int ticks ); | |
| int scaleMaxMajor() const; | | int scaleMaxMajor() const; | |
| | | | |
| void setScaleEngine( QwtScaleEngine * ); | | void setScaleEngine( QwtScaleEngine * ); | |
| const QwtScaleEngine *scaleEngine() const; | | const QwtScaleEngine *scaleEngine() const; | |
| QwtScaleEngine *scaleEngine(); | | QwtScaleEngine *scaleEngine(); | |
| | | | |
|
| | | int transform( double ) const; | |
| | | double invTransform( int ) const; | |
| | | | |
| | | bool isInverted() const; | |
| | | | |
| | | double minimum() const; | |
| | | double maximum() const; | |
| | | | |
| const QwtScaleMap &scaleMap() const; | | const QwtScaleMap &scaleMap() const; | |
| | | | |
| protected: | | protected: | |
|
| void rescale( double vmin, double vmax, double step = 0.0 ); | | void rescale( double lowerBound, | |
| | | double upperBound, double stepSize ); | |
| | | | |
| void setAbstractScaleDraw( QwtAbstractScaleDraw * ); | | void setAbstractScaleDraw( QwtAbstractScaleDraw * ); | |
|
| | | | |
| const QwtAbstractScaleDraw *abstractScaleDraw() const; | | const QwtAbstractScaleDraw *abstractScaleDraw() const; | |
| QwtAbstractScaleDraw *abstractScaleDraw(); | | QwtAbstractScaleDraw *abstractScaleDraw(); | |
| | | | |
| virtual void scaleChange(); | | virtual void scaleChange(); | |
| | | | |
| private: | | private: | |
| void updateScaleDraw(); | | void updateScaleDraw(); | |
| | | | |
| class PrivateData; | | class PrivateData; | |
| PrivateData *d_data; | | PrivateData *d_data; | |
| | | | |
End of changes. 11 change blocks. |
| 11 lines changed or deleted | | 49 lines changed or added | |
|
| qwt_abstract_scale_draw.h | | qwt_abstract_scale_draw.h | |
| | | | |
| skipping to change at line 20 | | skipping to change at line 20 | |
| #ifndef QWT_ABSTRACT_SCALE_DRAW_H | | #ifndef QWT_ABSTRACT_SCALE_DRAW_H | |
| #define QWT_ABSTRACT_SCALE_DRAW_H | | #define QWT_ABSTRACT_SCALE_DRAW_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include "qwt_scale_div.h" | | #include "qwt_scale_div.h" | |
| #include "qwt_text.h" | | #include "qwt_text.h" | |
| | | | |
| class QPalette; | | class QPalette; | |
| class QPainter; | | class QPainter; | |
| class QFont; | | class QFont; | |
|
| class QwtScaleTransformation; | | class QwtTransform; | |
| class QwtScaleMap; | | class QwtScaleMap; | |
| | | | |
| /*! | | /*! | |
| \brief A abstract base class for drawing scales | | \brief A abstract base class for drawing scales | |
| | | | |
| QwtAbstractScaleDraw can be used to draw linear or logarithmic scales. | | QwtAbstractScaleDraw can be used to draw linear or logarithmic scales. | |
| | | | |
| After a scale division has been specified as a QwtScaleDiv object | | After a scale division has been specified as a QwtScaleDiv object | |
|
| using QwtAbstractScaleDraw::setScaleDiv(const QwtScaleDiv &s), | | using setScaleDiv(), the scale can be drawn with the draw() member. | |
| the scale can be drawn with the QwtAbstractScaleDraw::draw() member. | | | |
| */ | | */ | |
| class QWT_EXPORT QwtAbstractScaleDraw | | class QWT_EXPORT QwtAbstractScaleDraw | |
| { | | { | |
| public: | | public: | |
| | | | |
| /*! | | /*! | |
| Components of a scale | | Components of a scale | |
| \sa enableComponent(), hasComponent | | \sa enableComponent(), hasComponent | |
| */ | | */ | |
| enum ScaleComponent | | enum ScaleComponent | |
| | | | |
| skipping to change at line 61 | | skipping to change at line 60 | |
| | | | |
| //! Scale components | | //! Scale components | |
| typedef QFlags<ScaleComponent> ScaleComponents; | | typedef QFlags<ScaleComponent> ScaleComponents; | |
| | | | |
| QwtAbstractScaleDraw(); | | QwtAbstractScaleDraw(); | |
| virtual ~QwtAbstractScaleDraw(); | | virtual ~QwtAbstractScaleDraw(); | |
| | | | |
| void setScaleDiv( const QwtScaleDiv &s ); | | void setScaleDiv( const QwtScaleDiv &s ); | |
| const QwtScaleDiv& scaleDiv() const; | | const QwtScaleDiv& scaleDiv() const; | |
| | | | |
|
| void setTransformation( QwtScaleTransformation * ); | | void setTransformation( QwtTransform * ); | |
| const QwtScaleMap &scaleMap() const; | | const QwtScaleMap &scaleMap() const; | |
| QwtScaleMap &scaleMap(); | | QwtScaleMap &scaleMap(); | |
| | | | |
| void enableComponent( ScaleComponent, bool enable = true ); | | void enableComponent( ScaleComponent, bool enable = true ); | |
| bool hasComponent( ScaleComponent ) const; | | bool hasComponent( ScaleComponent ) const; | |
| | | | |
| void setTickLength( QwtScaleDiv::TickType, double length ); | | void setTickLength( QwtScaleDiv::TickType, double length ); | |
| double tickLength( QwtScaleDiv::TickType ) const; | | double tickLength( QwtScaleDiv::TickType ) const; | |
| double maxTickLength() const; | | double maxTickLength() const; | |
| | | | |
| | | | |
| skipping to change at line 85 | | skipping to change at line 84 | |
| void setPenWidth( int width ); | | void setPenWidth( int width ); | |
| int penWidth() const; | | int penWidth() const; | |
| | | | |
| virtual void draw( QPainter *, const QPalette & ) const; | | virtual void draw( QPainter *, const QPalette & ) const; | |
| | | | |
| virtual QwtText label( double ) const; | | virtual QwtText label( double ) const; | |
| | | | |
| /*! | | /*! | |
| Calculate the extent | | Calculate the extent | |
| | | | |
|
| The extent is the distcance from the baseline to the outermost | | The extent is the distance from the baseline to the outermost | |
| pixel of the scale draw in opposite to its orientation. | | pixel of the scale draw in opposite to its orientation. | |
| It is at least minimumExtent() pixels. | | It is at least minimumExtent() pixels. | |
| | | | |
|
| | | \param font Font used for drawing the tick labels | |
| | | \return Number of pixels | |
| | | | |
| \sa setMinimumExtent(), minimumExtent() | | \sa setMinimumExtent(), minimumExtent() | |
| */ | | */ | |
|
| virtual double extent( const QFont & ) const = 0; | | virtual double extent( const QFont &font ) const = 0; | |
| | | | |
| void setMinimumExtent( double ); | | void setMinimumExtent( double ); | |
| double minimumExtent() const; | | double minimumExtent() const; | |
| | | | |
| protected: | | protected: | |
| /*! | | /*! | |
| Draw a tick | | Draw a tick | |
| | | | |
| \param painter Painter | | \param painter Painter | |
| \param value Value of the tick | | \param value Value of the tick | |
|
| \param len Lenght of the tick | | \param len Length of the tick | |
| | | | |
| \sa drawBackbone(), drawLabel() | | \sa drawBackbone(), drawLabel() | |
| */ | | */ | |
| virtual void drawTick( QPainter *painter, double value, double len ) co
nst = 0; | | virtual void drawTick( QPainter *painter, double value, double len ) co
nst = 0; | |
| | | | |
| /*! | | /*! | |
| Draws the baseline of the scale | | Draws the baseline of the scale | |
| \param painter Painter | | \param painter Painter | |
| | | | |
| \sa drawTick(), drawLabel() | | \sa drawTick(), drawLabel() | |
| | | | |
End of changes. 7 change blocks. |
| 7 lines changed or deleted | | 9 lines changed or added | |
|
| qwt_abstract_slider.h | | qwt_abstract_slider.h | |
| | | | |
| skipping to change at line 14 | | skipping to change at line 14 | |
| * Copyright (C) 2002 Uwe Rathmann | | * Copyright (C) 2002 Uwe Rathmann | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_ABSTRACT_SLIDER_H | | #ifndef QWT_ABSTRACT_SLIDER_H | |
| #define QWT_ABSTRACT_SLIDER_H | | #define QWT_ABSTRACT_SLIDER_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
|
| #include "qwt_double_range.h" | | #include "qwt_abstract_scale.h" | |
| #include <qwidget.h> | | | |
| | | | |
| /*! | | /*! | |
|
| \brief An abstract base class for slider widgets | | \brief An abstract base class for slider widgets with a scale | |
| | | | |
|
| QwtAbstractSlider is a base class for | | A slider widget displays a value according to a scale. | |
| slider widgets. It handles mouse events | | The class is designed as a common super class for widgets like | |
| and updates the slider's value accordingly. Derived classes | | QwtKnob, QwtDial and QwtSlider. | |
| only have to implement the getValue() and | | | |
| getScrollMode() members, and should react to a | | When the slider is nor readOnly() its value can be modified | |
| valueChange(), which normally requires repainting. | | by keyboard, mouse and wheel inputs. | |
| | | | |
| | | The range of the slider is divided into a number of steps from | |
| | | which the value increments according to user inputs depend. | |
| | | Only for linear scales the number of steps correspond with | |
| | | a fixed step size. | |
| */ | | */ | |
| | | | |
|
| class QWT_EXPORT QwtAbstractSlider : public QWidget, public QwtDoubleRange | | class QWT_EXPORT QwtAbstractSlider: public QwtAbstractScale | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
|
| | | | |
| | | Q_PROPERTY( double value READ value WRITE setValue ) | |
| | | | |
| | | Q_PROPERTY( uint totalSteps READ totalSteps WRITE setTotalSteps ) | |
| | | Q_PROPERTY( uint singleSteps READ singleSteps WRITE setSingleSteps ) | |
| | | Q_PROPERTY( uint pageSteps READ pageSteps WRITE setPageSteps ) | |
| | | Q_PROPERTY( bool stepAlignment READ stepAlignment WRITE setStepAlignmen | |
| | | t ) | |
| | | | |
| Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly ) | | Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly ) | |
|
| Q_PROPERTY( bool valid READ isValid WRITE setValid ) | | Q_PROPERTY( bool tracking READ isTracking WRITE setTracking ) | |
| Q_PROPERTY( double mass READ mass WRITE setMass ) | | Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping ) | |
| Q_PROPERTY( Qt::Orientation orientation | | | |
| READ orientation WRITE setOrientation ) | | | |
| | | | |
|
| public: | | Q_PROPERTY( bool invertedControls READ invertedControls WRITE setInvert | |
| /*! | | edControls ) | |
| Scroll mode | | | |
| \sa getScrollMode() | | | |
| */ | | | |
| enum ScrollMode | | | |
| { | | | |
| //! Scrolling switched off. Don't change the value. | | | |
| ScrNone, | | | |
| | | | |
| /*! | | | |
| Change the value while the user keeps the | | | |
| button pressed and moves the mouse. | | | |
| */ | | | |
| ScrMouse, | | | |
| | | | |
| /*! | | | |
| Automatic scrolling. Increment the value in the specified directi | | | |
| on | | | |
| as long as the user keeps the button pressed. | | | |
| */ | | | |
| ScrTimer, | | | |
| | | | |
| ScrDirect, | | | |
| | | | |
| //! Automatic scrolling. Same as ScrTimer, but increment by page si | | | |
| ze. | | | |
| ScrPage | | | |
| }; | | | |
| | | | |
|
| explicit QwtAbstractSlider( Qt::Orientation, QWidget *parent = NULL ); | | public: | |
| | | explicit QwtAbstractSlider( QWidget *parent = NULL ); | |
| virtual ~QwtAbstractSlider(); | | virtual ~QwtAbstractSlider(); | |
| | | | |
|
| void setUpdateTime( int t ); | | void setValid( bool ); | |
| void stopMoving(); | | bool isValid() const; | |
| void setTracking( bool enable ); | | | |
| | | | |
|
| virtual void setMass( double val ); | | double value() const; | |
| virtual double mass() const; | | | |
| | | | |
|
| virtual void setOrientation( Qt::Orientation o ); | | void setWrapping( bool ); | |
| Qt::Orientation orientation() const; | | bool wrapping() const; | |
| | | | |
|
| bool isReadOnly() const; | | void setTotalSteps( uint ); | |
| | | uint totalSteps() const; | |
| | | | |
|
| /* | | void setSingleSteps( uint ); | |
| Wrappers for QwtDblRange::isValid/QwtDblRange::setValid made | | uint singleSteps() const; | |
| to be available as Q_PROPERTY in the designer. | | | |
| */ | | | |
| | | | |
|
| /*! | | void setPageSteps( uint ); | |
| \sa QwtDblRange::isValid() | | uint pageSteps() const; | |
| */ | | | |
| bool isValid() const | | | |
| { | | | |
| return QwtDoubleRange::isValid(); | | | |
| } | | | |
| | | | |
|
| /*! | | void setStepAlignment( bool ); | |
| \param valid true/false | | bool stepAlignment() const; | |
| \sa QwtDblRange::isValid() | | | |
| */ | | | |
| void setValid( bool valid ) | | | |
| { | | | |
| QwtDoubleRange::setValid( valid ); | | | |
| } | | | |
| | | | |
|
| public Q_SLOTS: | | void setTracking( bool ); | |
| virtual void setValue( double val ); | | bool isTracking() const; | |
| virtual void fitValue( double val ); | | | |
| virtual void incValue( int steps ); | | void setReadOnly( bool ); | |
| | | bool isReadOnly() const; | |
| | | | |
| | | void setInvertedControls( bool ); | |
| | | bool invertedControls() const; | |
| | | | |
|
| virtual void setReadOnly( bool ); | | public Q_SLOTS: | |
| | | void setValue( double val ); | |
| | | | |
| Q_SIGNALS: | | Q_SIGNALS: | |
| | | | |
| /*! | | /*! | |
| \brief Notify a change of value. | | \brief Notify a change of value. | |
| | | | |
|
| In the default setting | | When tracking is enabled (default setting), | |
| (tracking enabled), this signal will be emitted every | | this signal will be emitted every time the value changes. | |
| time the value changes ( see setTracking() ). | | | |
| \param value new value | | \param value New value | |
| | | | |
| | | \sa setTracking(), sliderMoved() | |
| */ | | */ | |
| void valueChanged( double value ); | | void valueChanged( double value ); | |
| | | | |
| /*! | | /*! | |
| This signal is emitted when the user presses the | | This signal is emitted when the user presses the | |
|
| movable part of the slider (start ScrMouse Mode). | | movable part of the slider. | |
| */ | | */ | |
| void sliderPressed(); | | void sliderPressed(); | |
| | | | |
| /*! | | /*! | |
| This signal is emitted when the user releases the | | This signal is emitted when the user releases the | |
| movable part of the slider. | | movable part of the slider. | |
| */ | | */ | |
|
| | | | |
| void sliderReleased(); | | void sliderReleased(); | |
|
| | | | |
| /*! | | /*! | |
| This signal is emitted when the user moves the | | This signal is emitted when the user moves the | |
| slider with the mouse. | | slider with the mouse. | |
|
| \param value new value | | | |
| | | \param value New value | |
| | | | |
| | | \sa valueChanged() | |
| */ | | */ | |
| void sliderMoved( double value ); | | void sliderMoved( double value ); | |
| | | | |
| protected: | | protected: | |
|
| virtual void setPosition( const QPoint & ); | | virtual void mousePressEvent( QMouseEvent * ); | |
| virtual void valueChange(); | | virtual void mouseReleaseEvent( QMouseEvent * ); | |
| | | virtual void mouseMoveEvent( QMouseEvent * ); | |
| virtual void timerEvent( QTimerEvent *e ); | | virtual void keyPressEvent( QKeyEvent * ); | |
| virtual void mousePressEvent( QMouseEvent *e ); | | virtual void wheelEvent( QWheelEvent * ); | |
| virtual void mouseReleaseEvent( QMouseEvent *e ); | | | |
| virtual void mouseMoveEvent( QMouseEvent *e ); | | | |
| virtual void keyPressEvent( QKeyEvent *e ); | | | |
| virtual void wheelEvent( QWheelEvent *e ); | | | |
| | | | |
| /*! | | /*! | |
|
| \brief Determine the value corresponding to a specified poind | | \brief Determine what to do when the user presses a mouse button. | |
| | | | |
|
| This is an abstract virtual function which is called when | | \param pos Mouse position | |
| the user presses or releases a mouse button or moves the | | | |
| mouse. It has to be implemented by the derived class. | | \retval True, when pos is a valid scroll position | |
| \param p point | | \sa scrolledTo() | |
| */ | | */ | |
|
| virtual double getValue( const QPoint & p ) = 0; | | virtual bool isScrollPosition( const QPoint &pos ) const = 0; | |
| | | | |
| /*! | | /*! | |
|
| \brief Determine what to do when the user presses a mouse button. | | \brief Determine the value for a new position of the | |
| | | movable part of the slider | |
| | | | |
|
| This function is abstract and has to be implemented by derived classe | | \param pos Mouse position | |
| s. | | | |
| It is called on a mousePress event. The derived class can determine | | \return Value for the mouse position | |
| what should happen next in dependence of the position where the mouse | | \sa isScrollPosition() | |
| was pressed by returning scrolling mode and direction. | | | |
| | | | |
| \param pos point where the mouse was pressed | | | |
| \retval scrollMode The scrolling mode | | | |
| \retval direction direction: 1, 0, or -1. | | | |
| */ | | */ | |
|
| virtual void getScrollMode( const QPoint &pos, | | virtual double scrolledTo( const QPoint &pos ) const = 0; | |
| ScrollMode &scrollMode, int &direction ) const = 0; | | | |
| | | void incrementValue( int numSteps ); | |
| | | | |
|
| void setMouseOffset( double ); | | virtual void scaleChange(); | |
| double mouseOffset() const; | | | |
| | | protected: | |
| | | virtual void sliderChange(); | |
| | | | |
|
| int scrollMode() const; | | double incrementedValue( | |
| | | double value, int stepCount ) const; | |
| | | | |
| private: | | private: | |
|
| void buttonReleased(); | | double alignedValue( double ) const; | |
| | | double boundedValue( double ) const; | |
| | | | |
| class PrivateData; | | class PrivateData; | |
| PrivateData *d_data; | | PrivateData *d_data; | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 32 change blocks. |
| 114 lines changed or deleted | | 92 lines changed or added | |
|
| qwt_analog_clock.h | | qwt_analog_clock.h | |
| | | | |
| skipping to change at line 24 | | skipping to change at line 24 | |
| #include "qwt_dial.h" | | #include "qwt_dial.h" | |
| #include "qwt_dial_needle.h" | | #include "qwt_dial_needle.h" | |
| #include <qdatetime.h> | | #include <qdatetime.h> | |
| | | | |
| /*! | | /*! | |
| \brief An analog clock | | \brief An analog clock | |
| | | | |
| \image html analogclock.png | | \image html analogclock.png | |
| | | | |
| \par Example | | \par Example | |
|
| \verbatim #include <qwt_analog_clock.h> | | \code | |
| | | #include <qwt_analog_clock.h> | |
| | | | |
| QwtAnalogClock *clock = new QwtAnalogClock(...); | | QwtAnalogClock *clock = new QwtAnalogClock(...); | |
| clock->scaleDraw()->setPenWidth(3); | | clock->scaleDraw()->setPenWidth(3); | |
| clock->setLineWidth(6); | | clock->setLineWidth(6); | |
| clock->setFrameShadow(QwtDial::Sunken); | | clock->setFrameShadow(QwtDial::Sunken); | |
| clock->setTime(); | | clock->setTime(); | |
| | | | |
| // update the clock every second | | // update the clock every second | |
| QTimer *timer = new QTimer(clock); | | QTimer *timer = new QTimer(clock); | |
| timer->connect(timer, SIGNAL(timeout()), clock, SLOT(setCurrentTime())); | | timer->connect(timer, SIGNAL(timeout()), clock, SLOT(setCurrentTime())); | |
| timer->start(1000); | | timer->start(1000); | |
| | | | |
|
| \endverbatim | | \endcode | |
| | | | |
| Qwt is missing a set of good looking hands. | | | |
| Contributions are very welcome. | | | |
| | | | |
| \note The examples/dials example shows how to use QwtAnalogClock. | | \note The examples/dials example shows how to use QwtAnalogClock. | |
| */ | | */ | |
| | | | |
| class QWT_EXPORT QwtAnalogClock: public QwtDial | | class QWT_EXPORT QwtAnalogClock: public QwtDial | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| | | | |
| public: | | public: | |
| /*! | | /*! | |
| | | | |
| skipping to change at line 72 | | skipping to change at line 70 | |
| //! Needle displaying the hours | | //! Needle displaying the hours | |
| HourHand, | | HourHand, | |
| | | | |
| //! Number of needles | | //! Number of needles | |
| NHands | | NHands | |
| }; | | }; | |
| | | | |
| explicit QwtAnalogClock( QWidget* parent = NULL ); | | explicit QwtAnalogClock( QWidget* parent = NULL ); | |
| virtual ~QwtAnalogClock(); | | virtual ~QwtAnalogClock(); | |
| | | | |
|
| virtual void setHand( Hand, QwtDialNeedle * ); | | void setHand( Hand, QwtDialNeedle * ); | |
| | | | |
| const QwtDialNeedle *hand( Hand ) const; | | const QwtDialNeedle *hand( Hand ) const; | |
| QwtDialNeedle *hand( Hand ); | | QwtDialNeedle *hand( Hand ); | |
| | | | |
| public Q_SLOTS: | | public Q_SLOTS: | |
| void setCurrentTime(); | | void setCurrentTime(); | |
|
| void setTime( const QTime & = QTime::currentTime() ); | | void setTime( const QTime & ); | |
| | | | |
| protected: | | protected: | |
|
| virtual QwtText scaleLabel( double ) const; | | | |
| | | | |
| virtual void drawNeedle( QPainter *, const QPointF &, | | virtual void drawNeedle( QPainter *, const QPointF &, | |
| double radius, double direction, QPalette::ColorGroup ) const; | | double radius, double direction, QPalette::ColorGroup ) const; | |
| | | | |
| virtual void drawHand( QPainter *, Hand, const QPointF &, | | virtual void drawHand( QPainter *, Hand, const QPointF &, | |
| double radius, double direction, QPalette::ColorGroup ) const; | | double radius, double direction, QPalette::ColorGroup ) const; | |
| | | | |
| private: | | private: | |
|
| virtual void setNeedle( QwtDialNeedle * ); | | // use setHand instead | |
| void initClock(); | | void setNeedle( QwtDialNeedle * ); | |
| | | | |
| QwtDialNeedle *d_hand[NHands]; | | QwtDialNeedle *d_hand[NHands]; | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 6 change blocks. |
| 11 lines changed or deleted | | 8 lines changed or added | |
|
| qwt_color_map.h | | qwt_color_map.h | |
| | | | |
| skipping to change at line 43 | | skipping to change at line 43 | |
| class QWT_EXPORT QwtColorMap | | class QWT_EXPORT QwtColorMap | |
| { | | { | |
| public: | | public: | |
| /*! | | /*! | |
| Format for color mapping | | Format for color mapping | |
| \sa rgb(), colorIndex(), colorTable() | | \sa rgb(), colorIndex(), colorTable() | |
| */ | | */ | |
| | | | |
| enum Format | | enum Format | |
| { | | { | |
|
| //! The map is intended to map into QRgb values. | | //! The map is intended to map into RGB values. | |
| RGB, | | RGB, | |
| | | | |
| /*! | | /*! | |
| The map is intended to map into 8 bit values, that | | The map is intended to map into 8 bit values, that | |
| are indices into the color table. | | are indices into the color table. | |
| */ | | */ | |
| Indexed | | Indexed | |
| }; | | }; | |
| | | | |
| QwtColorMap( Format = QwtColorMap::RGB ); | | QwtColorMap( Format = QwtColorMap::RGB ); | |
| virtual ~QwtColorMap(); | | virtual ~QwtColorMap(); | |
| | | | |
| Format format() const; | | Format format() const; | |
| | | | |
| /*! | | /*! | |
|
| Map a value of a given interval into a rgb value. | | Map a value of a given interval into a RGB value. | |
| | | | |
| \param interval Range for the values | | \param interval Range for the values | |
| \param value Value | | \param value Value | |
|
| \return rgb value, corresponding to value | | \return RGB value, corresponding to value | |
| */ | | */ | |
| virtual QRgb rgb( const QwtInterval &interval, | | virtual QRgb rgb( const QwtInterval &interval, | |
| double value ) const = 0; | | double value ) const = 0; | |
| | | | |
| /*! | | /*! | |
| Map a value of a given interval into a color index | | Map a value of a given interval into a color index | |
|
| | | | |
| \param interval Range for the values | | \param interval Range for the values | |
| \param value Value | | \param value Value | |
| \return color index, corresponding to value | | \return color index, corresponding to value | |
| */ | | */ | |
| virtual unsigned char colorIndex( | | virtual unsigned char colorIndex( | |
| const QwtInterval &interval, double value ) const = 0; | | const QwtInterval &interval, double value ) const = 0; | |
| | | | |
| QColor color( const QwtInterval &, double value ) const; | | QColor color( const QwtInterval &, double value ) const; | |
| virtual QVector<QRgb> colorTable( const QwtInterval & ) const; | | virtual QVector<QRgb> colorTable( const QwtInterval & ) const; | |
| | | | |
| | | | |
| skipping to change at line 138 | | skipping to change at line 140 | |
| private: | | private: | |
| // Disabled copy constructor and operator= | | // Disabled copy constructor and operator= | |
| QwtLinearColorMap( const QwtLinearColorMap & ); | | QwtLinearColorMap( const QwtLinearColorMap & ); | |
| QwtLinearColorMap &operator=( const QwtLinearColorMap & ); | | QwtLinearColorMap &operator=( const QwtLinearColorMap & ); | |
| | | | |
| class PrivateData; | | class PrivateData; | |
| PrivateData *d_data; | | PrivateData *d_data; | |
| }; | | }; | |
| | | | |
| /*! | | /*! | |
|
| \brief QwtAlphaColorMap variies the alpha value of a color | | \brief QwtAlphaColorMap varies the alpha value of a color | |
| */ | | */ | |
| class QWT_EXPORT QwtAlphaColorMap: public QwtColorMap | | class QWT_EXPORT QwtAlphaColorMap: public QwtColorMap | |
| { | | { | |
| public: | | public: | |
| QwtAlphaColorMap( const QColor & = QColor( Qt::gray ) ); | | QwtAlphaColorMap( const QColor & = QColor( Qt::gray ) ); | |
| virtual ~QwtAlphaColorMap(); | | virtual ~QwtAlphaColorMap(); | |
| | | | |
| void setColor( const QColor & ); | | void setColor( const QColor & ); | |
| QColor color() const; | | QColor color() const; | |
| | | | |
| | | | |
End of changes. 5 change blocks. |
| 4 lines changed or deleted | | 6 lines changed or added | |
|
| qwt_compass.h | | qwt_compass.h | |
| | | | |
| skipping to change at line 15 | | skipping to change at line 15 | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_COMPASS_H | | #ifndef QWT_COMPASS_H | |
| #define QWT_COMPASS_H 1 | | #define QWT_COMPASS_H 1 | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include "qwt_dial.h" | | #include "qwt_dial.h" | |
|
| | | #include "qwt_round_scale_draw.h" | |
| #include <qstring.h> | | #include <qstring.h> | |
| #include <qmap.h> | | #include <qmap.h> | |
| | | | |
| class QwtCompassRose; | | class QwtCompassRose; | |
| | | | |
| /*! | | /*! | |
|
| | | \brief A special scale draw made for QwtCompass | |
| | | | |
| | | QwtCompassScaleDraw maps values to strings using | |
| | | a special map, that can be modified by the application | |
| | | | |
| | | The default map consists of the labels N, NE, E, SE, S, SW, W, NW. | |
| | | | |
| | | \sa QwtCompass | |
| | | */ | |
| | | class QWT_EXPORT QwtCompassScaleDraw: public QwtRoundScaleDraw | |
| | | { | |
| | | public: | |
| | | explicit QwtCompassScaleDraw(); | |
| | | explicit QwtCompassScaleDraw( const QMap<double, QString> &map ); | |
| | | | |
| | | void setLabelMap( const QMap<double, QString> &map ); | |
| | | QMap<double, QString> labelMap() const; | |
| | | | |
| | | virtual QwtText label( double value ) const; | |
| | | | |
| | | private: | |
| | | QMap<double, QString> d_labelMap; | |
| | | }; | |
| | | | |
| | | /*! | |
| \brief A Compass Widget | | \brief A Compass Widget | |
| | | | |
| QwtCompass is a widget to display and enter directions. It consists | | QwtCompass is a widget to display and enter directions. It consists | |
| of a scale, an optional needle and rose. | | of a scale, an optional needle and rose. | |
| | | | |
| \image html dials1.png | | \image html dials1.png | |
| | | | |
| \note The examples/dials example shows how to use QwtCompass. | | \note The examples/dials example shows how to use QwtCompass. | |
| */ | | */ | |
| | | | |
| | | | |
| skipping to change at line 43 | | skipping to change at line 69 | |
| Q_OBJECT | | Q_OBJECT | |
| | | | |
| public: | | public: | |
| explicit QwtCompass( QWidget* parent = NULL ); | | explicit QwtCompass( QWidget* parent = NULL ); | |
| virtual ~QwtCompass(); | | virtual ~QwtCompass(); | |
| | | | |
| void setRose( QwtCompassRose *rose ); | | void setRose( QwtCompassRose *rose ); | |
| const QwtCompassRose *rose() const; | | const QwtCompassRose *rose() const; | |
| QwtCompassRose *rose(); | | QwtCompassRose *rose(); | |
| | | | |
|
| const QMap<double, QString> &labelMap() const; | | | |
| QMap<double, QString> &labelMap(); | | | |
| void setLabelMap( const QMap<double, QString> &map ); | | | |
| | | | |
| protected: | | protected: | |
|
| virtual QwtText scaleLabel( double value ) const; | | | |
| | | | |
| virtual void drawRose( QPainter *, const QPointF ¢er, | | virtual void drawRose( QPainter *, const QPointF ¢er, | |
| double radius, double north, QPalette::ColorGroup ) const; | | double radius, double north, QPalette::ColorGroup ) const; | |
| | | | |
| virtual void drawScaleContents( QPainter *, | | virtual void drawScaleContents( QPainter *, | |
| const QPointF ¢er, double radius ) const; | | const QPointF ¢er, double radius ) const; | |
| | | | |
| virtual void keyPressEvent( QKeyEvent * ); | | virtual void keyPressEvent( QKeyEvent * ); | |
| | | | |
| private: | | private: | |
|
| void initCompass(); | | | |
| | | | |
| class PrivateData; | | class PrivateData; | |
| PrivateData *d_data; | | PrivateData *d_data; | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 5 change blocks. |
| 8 lines changed or deleted | | 26 lines changed or added | |
|
| qwt_counter.h | | qwt_counter.h | |
| | | | |
| skipping to change at line 14 | | skipping to change at line 14 | |
| * Copyright (C) 2002 Uwe Rathmann | | * Copyright (C) 2002 Uwe Rathmann | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_COUNTER_H | | #ifndef QWT_COUNTER_H | |
| #define QWT_COUNTER_H | | #define QWT_COUNTER_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
|
| #include "qwt_double_range.h" | | | |
| #include <qwidget.h> | | #include <qwidget.h> | |
| | | | |
| /*! | | /*! | |
| \brief The Counter Widget | | \brief The Counter Widget | |
| | | | |
|
| A Counter consists of a lineEdit displaying a number and | | A Counter consists of a label displaying a number and | |
| one ore more (up to three) push buttons on each side | | one ore more (up to three) push buttons on each side | |
|
| of the lineEdit which can be used to increment or decrement | | of the label which can be used to increment or decrement | |
| the counter's value. | | the counter's value. | |
| | | | |
|
| A Counter has a range from a minimum value to a maximum value | | A counter has a range from a minimum value to a maximum value | |
| and a step size. The range can be specified using setRange(). | | and a step size. When the wrapping property is set | |
| The number of steps by which a button increments or decrements | | the counter is circular. | |
| the value can be specified using setIncSteps(). | | | |
| The number of buttons can be changed with setNumButtons(). | | The number of steps by which a button increments or decrements the value | |
| | | can be specified using setIncSteps(). The number of buttons can be | |
| | | changed with setNumButtons(). | |
| | | | |
| Example: | | Example: | |
| \code | | \code | |
| #include <qwt_counter.h> | | #include <qwt_counter.h> | |
| | | | |
| QwtCounter *counter = new QwtCounter(parent); | | QwtCounter *counter = new QwtCounter(parent); | |
| | | | |
|
| counter->setRange(0.0, 100.0, 1.0); // From 0.0 to 100, step 1. | | counter->setRange(0.0, 100.0); // From 0.0 to 100 | |
| 0 | | counter->setSingleStep( 1.0 ); // Step size 1.0 | |
| counter->setNumButtons(2); // Two buttons each side | | counter->setNumButtons(2); // Two buttons each side | |
| counter->setIncSteps(QwtCounter::Button1, 1); // Button 1 increments 1 st
ep | | counter->setIncSteps(QwtCounter::Button1, 1); // Button 1 increments 1 st
ep | |
| counter->setIncSteps(QwtCounter::Button2, 20); // Button 2 increments 20 s
teps | | counter->setIncSteps(QwtCounter::Button2, 20); // Button 2 increments 20 s
teps | |
| | | | |
|
| connect(counter, SIGNAL(valueChanged(double)), my_class, SLOT(newValue(doub
le))); | | connect(counter, SIGNAL(valueChanged(double)), myClass, SLOT(newValue(doubl
e))); | |
| \endcode | | \endcode | |
| */ | | */ | |
| | | | |
|
| class QWT_EXPORT QwtCounter : public QWidget, public QwtDoubleRange | | class QWT_EXPORT QwtCounter : public QWidget | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| | | | |
|
| | | Q_PROPERTY( double value READ value WRITE setValue ) | |
| | | Q_PROPERTY( double minimum READ minimum WRITE setMinimum ) | |
| | | Q_PROPERTY( double maximum READ maximum WRITE setMaximum ) | |
| | | Q_PROPERTY( double singleStep READ singleStep WRITE setSingleStep ) | |
| | | | |
| Q_PROPERTY( int numButtons READ numButtons WRITE setNumButtons ) | | Q_PROPERTY( int numButtons READ numButtons WRITE setNumButtons ) | |
|
| Q_PROPERTY( double basicstep READ step WRITE setStep ) | | | |
| Q_PROPERTY( double minValue READ minValue WRITE setMinValue ) | | | |
| Q_PROPERTY( double maxValue READ maxValue WRITE setMaxValue ) | | | |
| Q_PROPERTY( int stepButton1 READ stepButton1 WRITE setStepButton1 ) | | Q_PROPERTY( int stepButton1 READ stepButton1 WRITE setStepButton1 ) | |
| Q_PROPERTY( int stepButton2 READ stepButton2 WRITE setStepButton2 ) | | Q_PROPERTY( int stepButton2 READ stepButton2 WRITE setStepButton2 ) | |
| Q_PROPERTY( int stepButton3 READ stepButton3 WRITE setStepButton3 ) | | Q_PROPERTY( int stepButton3 READ stepButton3 WRITE setStepButton3 ) | |
|
| Q_PROPERTY( double value READ value WRITE setValue ) | | | |
| Q_PROPERTY( bool editable READ editable WRITE setEditable ) | | Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly ) | |
| | | Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping ) | |
| | | | |
| public: | | public: | |
| //! Button index | | //! Button index | |
| enum Button | | enum Button | |
| { | | { | |
| //! Button intended for minor steps | | //! Button intended for minor steps | |
| Button1, | | Button1, | |
| | | | |
| //! Button intended for medium steps | | //! Button intended for medium steps | |
| Button2, | | Button2, | |
| | | | |
| skipping to change at line 80 | | skipping to change at line 85 | |
| //! Button intended for large steps | | //! Button intended for large steps | |
| Button3, | | Button3, | |
| | | | |
| //! Number of buttons | | //! Number of buttons | |
| ButtonCnt | | ButtonCnt | |
| }; | | }; | |
| | | | |
| explicit QwtCounter( QWidget *parent = NULL ); | | explicit QwtCounter( QWidget *parent = NULL ); | |
| virtual ~QwtCounter(); | | virtual ~QwtCounter(); | |
| | | | |
|
| bool editable() const; | | void setValid( bool ); | |
| void setEditable( bool ); | | bool isValid() const; | |
| | | | |
| | | void setWrapping( bool ); | |
| | | bool wrapping() const; | |
| | | | |
| | | bool isReadOnly() const; | |
| | | void setReadOnly( bool ); | |
| | | | |
| void setNumButtons( int n ); | | void setNumButtons( int n ); | |
| int numButtons() const; | | int numButtons() const; | |
| | | | |
| void setIncSteps( QwtCounter::Button btn, int nSteps ); | | void setIncSteps( QwtCounter::Button btn, int nSteps ); | |
| int incSteps( QwtCounter::Button btn ) const; | | int incSteps( QwtCounter::Button btn ) const; | |
| | | | |
|
| virtual void setValue( double ); | | | |
| virtual QSize sizeHint() const; | | virtual QSize sizeHint() const; | |
| | | | |
|
| // a set of dummies to help the designer | | double singleStep() const; | |
| | | void setSingleStep( double s ); | |
| | | | |
|
| double step() const; | | void setRange( double min, double max ); | |
| void setStep( double s ); | | | |
| | | | |
|
| double minValue() const; | | double minimum() const; | |
| void setMinValue( double m ); | | void setMinimum( double min ); | |
| | | | |
|
| double maxValue() const; | | double maximum() const; | |
| void setMaxValue( double m ); | | void setMaximum( double max ); | |
| | | | |
| void setStepButton1( int nSteps ); | | void setStepButton1( int nSteps ); | |
| int stepButton1() const; | | int stepButton1() const; | |
| | | | |
| void setStepButton2( int nSteps ); | | void setStepButton2( int nSteps ); | |
| int stepButton2() const; | | int stepButton2() const; | |
| | | | |
| void setStepButton3( int nSteps ); | | void setStepButton3( int nSteps ); | |
| int stepButton3() const; | | int stepButton3() const; | |
| | | | |
|
| virtual double value() const; | | double value() const; | |
| | | | |
| | | public Q_SLOTS: | |
| | | void setValue( double ); | |
| | | | |
| Q_SIGNALS: | | Q_SIGNALS: | |
| /*! | | /*! | |
| This signal is emitted when a button has been released | | This signal is emitted when a button has been released | |
| \param value The new value | | \param value The new value | |
| */ | | */ | |
| void buttonReleased ( double value ); | | void buttonReleased ( double value ); | |
| | | | |
| /*! | | /*! | |
| This signal is emitted when the counter's value has changed | | This signal is emitted when the counter's value has changed | |
| \param value The new value | | \param value The new value | |
| */ | | */ | |
| void valueChanged ( double value ); | | void valueChanged ( double value ); | |
| | | | |
| protected: | | protected: | |
| virtual bool event( QEvent * ); | | virtual bool event( QEvent * ); | |
| virtual void wheelEvent( QWheelEvent * ); | | virtual void wheelEvent( QWheelEvent * ); | |
| virtual void keyPressEvent( QKeyEvent * ); | | virtual void keyPressEvent( QKeyEvent * ); | |
|
| virtual void rangeChange(); | | | |
| | | | |
| private Q_SLOTS: | | private Q_SLOTS: | |
| void btnReleased(); | | void btnReleased(); | |
| void btnClicked(); | | void btnClicked(); | |
| void textChanged(); | | void textChanged(); | |
| | | | |
| private: | | private: | |
|
| | | void incrementValue( int numSteps ); | |
| void initCounter(); | | void initCounter(); | |
| void updateButtons(); | | void updateButtons(); | |
|
| void showNum( double ); | | void showNumber( double ); | |
| virtual void valueChange(); | | | |
| | | | |
| class PrivateData; | | class PrivateData; | |
| PrivateData *d_data; | | PrivateData *d_data; | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 20 change blocks. |
| 31 lines changed or deleted | | 42 lines changed or added | |
|
| qwt_dial.h | | qwt_dial.h | |
| | | | |
| skipping to change at line 15 | | skipping to change at line 15 | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_DIAL_H | | #ifndef QWT_DIAL_H | |
| #define QWT_DIAL_H 1 | | #define QWT_DIAL_H 1 | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include "qwt_abstract_slider.h" | | #include "qwt_abstract_slider.h" | |
|
| #include "qwt_round_scale_draw.h" | | #include "qwt_abstract_scale_draw.h" | |
| #include <qframe.h> | | #include <qframe.h> | |
| #include <qpalette.h> | | #include <qpalette.h> | |
| | | | |
| class QwtDialNeedle; | | class QwtDialNeedle; | |
|
| class QwtDial; | | class QwtRoundScaleDraw; | |
| | | | |
| /*! | | | |
| \brief A special scale draw made for QwtDial | | | |
| | | | |
| \sa QwtDial, QwtCompass | | | |
| */ | | | |
| class QWT_EXPORT QwtDialScaleDraw: public QwtRoundScaleDraw | | | |
| { | | | |
| public: | | | |
| explicit QwtDialScaleDraw( QwtDial * ); | | | |
| | | | |
| virtual QwtText label( double value ) const; | | | |
| | | | |
| void setPenWidth( double ); | | | |
| double penWidth() const; | | | |
| | | | |
| private: | | | |
| QwtDial *d_parent; | | | |
| double d_penWidth; | | | |
| }; | | | |
| | | | |
| /*! | | /*! | |
| \brief QwtDial class provides a rounded range control. | | \brief QwtDial class provides a rounded range control. | |
| | | | |
| QwtDial is intended as base class for dial widgets like | | QwtDial is intended as base class for dial widgets like | |
| speedometers, compass widgets, clocks ... | | speedometers, compass widgets, clocks ... | |
| | | | |
| \image html dials2.png | | \image html dials2.png | |
| | | | |
| A dial contains a scale and a needle indicating the current value | | A dial contains a scale and a needle indicating the current value | |
| of the dial. Depending on Mode one of them is fixed and the | | of the dial. Depending on Mode one of them is fixed and the | |
| other is rotating. If not isReadOnly() the | | other is rotating. If not isReadOnly() the | |
| dial can be rotated by dragging the mouse or using keyboard inputs | | dial can be rotated by dragging the mouse or using keyboard inputs | |
|
| (see keyPressEvent()). A dial might be wrapping, what means | | (see QwtAbstractSlider::keyPressEvent()). A dial might be wrapping, what
means | |
| a rotation below/above one limit continues on the other limit (f.e compas
s). | | a rotation below/above one limit continues on the other limit (f.e compas
s). | |
| The scale might cover any arc of the dial, its values are related to | | The scale might cover any arc of the dial, its values are related to | |
| the origin() of the dial. | | the origin() of the dial. | |
| | | | |
|
| Qwt is missing a set of good looking needles (QwtDialNeedle). | | Often dials have to be updated very often according to values from extern | |
| Contributions are very welcome. | | al | |
| | | devices. For these high refresh rates QwtDial caches as much as possible. | |
| | | For derived classes it might be necessary to clear these caches manually | |
| | | according to attribute changes using invalidateCache(). | |
| | | | |
| \sa QwtCompass, QwtAnalogClock, QwtDialNeedle | | \sa QwtCompass, QwtAnalogClock, QwtDialNeedle | |
|
| \note The examples/dials example shows different types of dials. | | \note The controls and dials examples shows different types of dials. | |
| | | \note QDial is more similar to QwtKnob than to QwtDial | |
| */ | | */ | |
| | | | |
| class QWT_EXPORT QwtDial: public QwtAbstractSlider | | class QWT_EXPORT QwtDial: public QwtAbstractSlider | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| | | | |
|
| Q_ENUMS( Shadow ) | | Q_ENUMS( Shadow Mode Direction ) | |
| Q_ENUMS( Mode ) | | | |
| Q_ENUMS( Direction ) | | | |
| | | | |
| Q_PROPERTY( int lineWidth READ lineWidth WRITE setLineWidth ) | | Q_PROPERTY( int lineWidth READ lineWidth WRITE setLineWidth ) | |
| Q_PROPERTY( Shadow frameShadow READ frameShadow WRITE setFrameShadow ) | | Q_PROPERTY( Shadow frameShadow READ frameShadow WRITE setFrameShadow ) | |
| Q_PROPERTY( Mode mode READ mode WRITE setMode ) | | Q_PROPERTY( Mode mode READ mode WRITE setMode ) | |
| Q_PROPERTY( double origin READ origin WRITE setOrigin ) | | Q_PROPERTY( double origin READ origin WRITE setOrigin ) | |
|
| Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping ) | | Q_PROPERTY( double minScaleArc READ minScaleArc WRITE setMinScaleArc ) | |
| Q_PROPERTY( Direction direction READ direction WRITE setDirection ) | | Q_PROPERTY( double maxScaleArc READ maxScaleArc WRITE setMaxScaleArc ) | |
| | | | |
|
| friend class QwtDialScaleDraw; | | | |
| public: | | public: | |
| | | | |
| /*! | | /*! | |
| \brief Frame shadow | | \brief Frame shadow | |
| | | | |
| Unfortunately it is not possible to use QFrame::Shadow | | Unfortunately it is not possible to use QFrame::Shadow | |
| as a property of a widget that is not derived from QFrame. | | as a property of a widget that is not derived from QFrame. | |
| The following enum is made for the designer only. It is safe | | The following enum is made for the designer only. It is safe | |
| to use QFrame::Shadow instead. | | to use QFrame::Shadow instead. | |
| */ | | */ | |
| | | | |
| skipping to change at line 104 | | skipping to change at line 84 | |
| //! QFrame::Plain | | //! QFrame::Plain | |
| Plain = QFrame::Plain, | | Plain = QFrame::Plain, | |
| | | | |
| //! QFrame::Raised | | //! QFrame::Raised | |
| Raised = QFrame::Raised, | | Raised = QFrame::Raised, | |
| | | | |
| //! QFrame::Sunken | | //! QFrame::Sunken | |
| Sunken = QFrame::Sunken | | Sunken = QFrame::Sunken | |
| }; | | }; | |
| | | | |
|
| //! Mode controlling wether the needle or the scale is rotating | | //! Mode controlling whether the needle or the scale is rotating | |
| enum Mode | | enum Mode | |
| { | | { | |
| //! The needle is rotating | | //! The needle is rotating | |
| RotateNeedle, | | RotateNeedle, | |
| | | | |
| //! The needle is fixed, the scales are rotating | | //! The needle is fixed, the scales are rotating | |
| RotateScale | | RotateScale | |
| }; | | }; | |
| | | | |
|
| //! Direction of the dial | | | |
| enum Direction | | | |
| { | | | |
| //! Clockwise | | | |
| Clockwise, | | | |
| | | | |
| //! Counter clockwise | | | |
| CounterClockwise | | | |
| }; | | | |
| | | | |
| explicit QwtDial( QWidget *parent = NULL ); | | explicit QwtDial( QWidget *parent = NULL ); | |
| virtual ~QwtDial(); | | virtual ~QwtDial(); | |
| | | | |
| void setFrameShadow( Shadow ); | | void setFrameShadow( Shadow ); | |
| Shadow frameShadow() const; | | Shadow frameShadow() const; | |
| | | | |
| void setLineWidth( int ); | | void setLineWidth( int ); | |
| int lineWidth() const; | | int lineWidth() const; | |
| | | | |
| void setMode( Mode ); | | void setMode( Mode ); | |
| Mode mode() const; | | Mode mode() const; | |
| | | | |
|
| virtual void setWrapping( bool ); | | | |
| bool wrapping() const; | | | |
| | | | |
| virtual void setScale( int maxMajIntv, int maxMinIntv, double step = 0. | | | |
| 0 ); | | | |
| | | | |
| void setScaleArc( double min, double max ); | | void setScaleArc( double min, double max ); | |
|
| void setScaleComponents( QwtAbstractScaleDraw::ScaleComponents ); | | | |
| void setScaleTicks( int minLen, int medLen, int majLen, int penWidth = | | | |
| 1 ); | | | |
| | | | |
|
| | | void setMinScaleArc( double min ); | |
| double minScaleArc() const; | | double minScaleArc() const; | |
|
| | | | |
| | | void setMaxScaleArc( double min ); | |
| double maxScaleArc() const; | | double maxScaleArc() const; | |
| | | | |
| virtual void setOrigin( double ); | | virtual void setOrigin( double ); | |
| double origin() const; | | double origin() const; | |
| | | | |
|
| void setDirection( Direction ); | | void setNeedle( QwtDialNeedle * ); | |
| Direction direction() const; | | | |
| | | | |
| virtual void setNeedle( QwtDialNeedle * ); | | | |
| const QwtDialNeedle *needle() const; | | const QwtDialNeedle *needle() const; | |
| QwtDialNeedle *needle(); | | QwtDialNeedle *needle(); | |
| | | | |
|
| QRectF boundingRect() const; | | QRect boundingRect() const; | |
| QRectF innerRect() const; | | QRect innerRect() const; | |
| virtual QRectF scaleInnerRect() const; | | | |
| | | virtual QRect scaleInnerRect() const; | |
| | | | |
| virtual QSize sizeHint() const; | | virtual QSize sizeHint() const; | |
| virtual QSize minimumSizeHint() const; | | virtual QSize minimumSizeHint() const; | |
| | | | |
|
| virtual void setScaleDraw( QwtDialScaleDraw * ); | | void setScaleDraw( QwtRoundScaleDraw * ); | |
| | | | |
|
| QwtDialScaleDraw *scaleDraw(); | | QwtRoundScaleDraw *scaleDraw(); | |
| const QwtDialScaleDraw *scaleDraw() const; | | const QwtRoundScaleDraw *scaleDraw() const; | |
| | | | |
| protected: | | protected: | |
|
| | | virtual void wheelEvent( QWheelEvent * ); | |
| virtual void paintEvent( QPaintEvent * ); | | virtual void paintEvent( QPaintEvent * ); | |
|
| virtual void keyPressEvent( QKeyEvent * ); | | virtual void changeEvent( QEvent * ); | |
| | | | |
| virtual void drawFrame( QPainter *p ); | | virtual void drawFrame( QPainter *p ); | |
| virtual void drawContents( QPainter * ) const; | | virtual void drawContents( QPainter * ) const; | |
| virtual void drawFocusIndicator( QPainter * ) const; | | virtual void drawFocusIndicator( QPainter * ) const; | |
| | | | |
|
| virtual void drawScale( | | void invalidateCache(); | |
| QPainter *, const QPointF ¢er, | | | |
| double radius, double origin, | | | |
| double arcMin, double arcMax ) const; | | | |
| | | | |
| /*! | | | |
| Draw the contents inside the scale | | | |
| | | | |
|
| Paints nothing. | | virtual void drawScale( QPainter *, | |
| | | const QPointF ¢er, double radius ) const; | |
| | | | |
|
| \param painter Painter | | | |
| \param center Center of the contents circle | | | |
| \param radius Radius of the contents circle | | | |
| */ | | | |
| virtual void drawScaleContents( QPainter *painter, | | virtual void drawScaleContents( QPainter *painter, | |
| const QPointF ¢er, double radius ) const; | | const QPointF ¢er, double radius ) const; | |
| | | | |
| virtual void drawNeedle( QPainter *, const QPointF &, | | virtual void drawNeedle( QPainter *, const QPointF &, | |
| double radius, double direction, QPalette::ColorGroup ) const; | | double radius, double direction, QPalette::ColorGroup ) const; | |
| | | | |
|
| virtual QwtText scaleLabel( double ) const; | | virtual double scrolledTo( const QPoint & ) const; | |
| void updateScale(); | | virtual bool isScrollPosition( const QPoint & ) const; | |
| | | | |
| virtual void rangeChange(); | | | |
| virtual void valueChange(); | | | |
| | | | |
|
| virtual double getValue( const QPoint & ); | | virtual void sliderChange(); | |
| virtual void getScrollMode( const QPoint &, | | virtual void scaleChange(); | |
| QwtAbstractSlider::ScrollMode &, int &direction ) const; | | | |
| | | | |
| private: | | private: | |
|
| void initDial(); | | void setAngleRange( double angle, double span ); | |
| | | void drawNeedle( QPainter * ) const; | |
| | | | |
| class PrivateData; | | class PrivateData; | |
| PrivateData *d_data; | | PrivateData *d_data; | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 26 change blocks. |
| 84 lines changed or deleted | | 36 lines changed or added | |
|
| qwt_event_pattern.h | | qwt_event_pattern.h | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 35 | |
| the application code can be configured by individual mappings. | | the application code can be configured by individual mappings. | |
| | | | |
| \sa QwtPicker, QwtPickerMachine, QwtPlotZoomer | | \sa QwtPicker, QwtPickerMachine, QwtPlotZoomer | |
| */ | | */ | |
| class QWT_EXPORT QwtEventPattern | | class QWT_EXPORT QwtEventPattern | |
| { | | { | |
| public: | | public: | |
| /*! | | /*! | |
| \brief Symbolic mouse input codes | | \brief Symbolic mouse input codes | |
| | | | |
|
| The default initialization for 3 button mice is: | | QwtEventPattern implements 3 different settings for | |
| - MouseSelect1\n | | mice with 1, 2, or 3 buttons that can be activated | |
| Qt::LeftButton | | using initMousePattern(). The default setting is for | |
| - MouseSelect2\n | | 3 button mice. | |
| Qt::RightButton | | | |
| - MouseSelect3\n | | | |
| Qt::MidButton | | | |
| - MouseSelect4\n | | | |
| Qt::LeftButton + Qt::ShiftButton | | | |
| - MouseSelect5\n | | | |
| Qt::RightButton + Qt::ShiftButton | | | |
| - MouseSelect6\n | | | |
| Qt::MidButton + Qt::ShiftButton | | | |
| | | | |
| The default initialization for 2 button mice is: | | | |
| - MouseSelect1\n | | | |
| Qt::LeftButton | | | |
| - MouseSelect2\n | | | |
| Qt::RightButton | | | |
| - MouseSelect3\n | | | |
| Qt::LeftButton + Qt::AltButton | | | |
| - MouseSelect4\n | | | |
| Qt::LeftButton + Qt::ShiftButton | | | |
| - MouseSelect5\n | | | |
| Qt::RightButton + Qt::ShiftButton | | | |
| - MouseSelect6\n | | | |
| Qt::LeftButton + Qt::AltButton + Qt::ShiftButton | | | |
| | | | |
| The default initialization for 1 button mice is: | | | |
| - MouseSelect1\n | | | |
| Qt::LeftButton | | | |
| - MouseSelect2\n | | | |
| Qt::LeftButton + Qt::ControlButton | | | |
| - MouseSelect3\n | | | |
| Qt::LeftButton + Qt::AltButton | | | |
| - MouseSelect4\n | | | |
| Qt::LeftButton + Qt::ShiftButton | | | |
| - MouseSelect5\n | | | |
| Qt::LeftButton + Qt::ControlButton + Qt::ShiftButton | | | |
| - MouseSelect6\n | | | |
| Qt::LeftButton + Qt::AltButton + Qt::ShiftButton | | | |
| | | | |
|
| \sa initMousePattern() | | Individual settings can be configured using setMousePattern(). | |
| */ | | | |
| | | | |
|
| | | \sa initMousePattern(), setMousePattern(), setKeyPattern() | |
| | | */ | |
| enum MousePatternCode | | enum MousePatternCode | |
| { | | { | |
|
| | | /*! | |
| | | The default setting for 1, 2 and 3 button mice is: | |
| | | | |
| | | - Qt::LeftButton | |
| | | - Qt::LeftButton | |
| | | - Qt::LeftButton | |
| | | */ | |
| MouseSelect1, | | MouseSelect1, | |
|
| | | | |
| | | /*! | |
| | | The default setting for 1, 2 and 3 button mice is: | |
| | | | |
| | | - Qt::LeftButton + Qt::ControlModifier | |
| | | - Qt::RightButton | |
| | | - Qt::RightButton | |
| | | */ | |
| MouseSelect2, | | MouseSelect2, | |
|
| | | | |
| | | /*! | |
| | | The default setting for 1, 2 and 3 button mice is: | |
| | | | |
| | | - Qt::LeftButton + Qt::AltModifier | |
| | | - Qt::LeftButton + Qt::AltModifier | |
| | | - Qt::MidButton | |
| | | */ | |
| MouseSelect3, | | MouseSelect3, | |
|
| | | | |
| | | /*! | |
| | | The default setting for 1, 2 and 3 button mice is: | |
| | | | |
| | | - Qt::LeftButton + Qt::ShiftModifier | |
| | | - Qt::LeftButton + Qt::ShiftModifier | |
| | | - Qt::LeftButton + Qt::ShiftModifier | |
| | | */ | |
| MouseSelect4, | | MouseSelect4, | |
|
| | | | |
| | | /*! | |
| | | The default setting for 1, 2 and 3 button mice is: | |
| | | | |
| | | - Qt::LeftButton + Qt::ControlButton | Qt::ShiftModifier | |
| | | - Qt::RightButton + Qt::ShiftModifier | |
| | | - Qt::RightButton + Qt::ShiftModifier | |
| | | */ | |
| MouseSelect5, | | MouseSelect5, | |
|
| | | | |
| | | /*! | |
| | | The default setting for 1, 2 and 3 button mice is: | |
| | | | |
| | | - Qt::LeftButton + Qt::AltModifier + Qt::ShiftModifier | |
| | | - Qt::LeftButton + Qt::AltModifier | Qt::ShiftModifier | |
| | | - Qt::MidButton + Qt::ShiftModifier | |
| | | */ | |
| MouseSelect6, | | MouseSelect6, | |
| | | | |
|
| | | //! Number of mouse patterns | |
| MousePatternCount | | MousePatternCount | |
| }; | | }; | |
| | | | |
| /*! | | /*! | |
| \brief Symbolic keyboard input codes | | \brief Symbolic keyboard input codes | |
| | | | |
|
| Default initialization: | | Individual settings can be configured using setKeyPattern() | |
| - KeySelect1\n | | | |
| Qt::Key_Return | | \sa setKeyPattern(), setMousePattern() | |
| - KeySelect2\n | | | |
| Qt::Key_Space | | | |
| - KeyAbort\n | | | |
| Qt::Key_Escape | | | |
| | | | |
| - KeyLeft\n | | | |
| Qt::Key_Left | | | |
| - KeyRight\n | | | |
| Qt::Key_Right | | | |
| - KeyUp\n | | | |
| Qt::Key_Up | | | |
| - KeyDown\n | | | |
| Qt::Key_Down | | | |
| | | | |
| - KeyUndo\n | | | |
| Qt::Key_Minus | | | |
| - KeyRedo\n | | | |
| Qt::Key_Plus | | | |
| - KeyHome\n | | | |
| Qt::Key_Escape | | | |
| */ | | */ | |
| enum KeyPatternCode | | enum KeyPatternCode | |
| { | | { | |
|
| | | //! Qt::Key_Return | |
| KeySelect1, | | KeySelect1, | |
|
| | | | |
| | | //! Qt::Key_Space | |
| KeySelect2, | | KeySelect2, | |
|
| | | | |
| | | //! Qt::Key_Escape | |
| KeyAbort, | | KeyAbort, | |
| | | | |
|
| | | //! Qt::Key_Left | |
| KeyLeft, | | KeyLeft, | |
|
| | | | |
| | | //! Qt::Key_Right | |
| KeyRight, | | KeyRight, | |
|
| | | | |
| | | //! Qt::Key_Up | |
| KeyUp, | | KeyUp, | |
|
| | | | |
| | | //! Qt::Key_Down | |
| KeyDown, | | KeyDown, | |
| | | | |
|
| | | //! Qt::Key_Plus | |
| KeyRedo, | | KeyRedo, | |
|
| | | | |
| | | //! Qt::Key_Minus | |
| KeyUndo, | | KeyUndo, | |
|
| | | | |
| | | //! Qt::Key_Escape | |
| KeyHome, | | KeyHome, | |
| | | | |
|
| | | //! Number of key patterns | |
| KeyPatternCount | | KeyPatternCount | |
| }; | | }; | |
| | | | |
| //! A pattern for mouse events | | //! A pattern for mouse events | |
| class MousePattern | | class MousePattern | |
| { | | { | |
| public: | | public: | |
| //! Constructor | | //! Constructor | |
|
| MousePattern( int btn = Qt::NoButton, int st = Qt::NoButton ) | | MousePattern( Qt::MouseButton btn = Qt::NoButton, | |
| | | Qt::KeyboardModifiers modifierCodes = Qt::NoModifier ): | |
| | | button( btn ), | |
| | | modifiers( modifierCodes ) | |
| { | | { | |
|
| button = btn; | | | |
| state = st; | | | |
| } | | } | |
| | | | |
|
| //! Button code | | //! Button | |
| int button; | | Qt::MouseButton button; | |
| | | | |
|
| //! State | | //! Keyboard modifier | |
| int state; | | Qt::KeyboardModifiers modifiers; | |
| }; | | }; | |
| | | | |
| //! A pattern for key events | | //! A pattern for key events | |
| class KeyPattern | | class KeyPattern | |
| { | | { | |
| public: | | public: | |
| //! Constructor | | //! Constructor | |
|
| KeyPattern( int k = 0, int st = Qt::NoButton ) | | KeyPattern( int keyCode = Qt::Key_unknown, | |
| | | Qt::KeyboardModifiers modifierCodes = Qt::NoModifier ): | |
| | | key( keyCode ), | |
| | | modifiers( modifierCodes ) | |
| { | | { | |
|
| key = k; | | | |
| state = st; | | | |
| } | | } | |
| | | | |
| //! Key code | | //! Key code | |
| int key; | | int key; | |
| | | | |
|
| //! State | | //! Modifiers | |
| int state; | | Qt::KeyboardModifiers modifiers; | |
| }; | | }; | |
| | | | |
| QwtEventPattern(); | | QwtEventPattern(); | |
| virtual ~QwtEventPattern(); | | virtual ~QwtEventPattern(); | |
| | | | |
| void initMousePattern( int numButtons ); | | void initMousePattern( int numButtons ); | |
| void initKeyPattern(); | | void initKeyPattern(); | |
| | | | |
|
| void setMousePattern( uint pattern, int button, int state = Qt::NoButto | | void setMousePattern( MousePatternCode, Qt::MouseButton button, | |
| n ); | | Qt::KeyboardModifiers = Qt::NoModifier ); | |
| void setKeyPattern( uint pattern, int key, int state = Qt::NoButton ); | | | |
| | | void setKeyPattern( KeyPatternCode, int keyCode, | |
| | | Qt::KeyboardModifiers modifierCodes = Qt::NoModifier ); | |
| | | | |
| void setMousePattern( const QVector<MousePattern> & ); | | void setMousePattern( const QVector<MousePattern> & ); | |
| void setKeyPattern( const QVector<KeyPattern> & ); | | void setKeyPattern( const QVector<KeyPattern> & ); | |
| | | | |
| const QVector<MousePattern> &mousePattern() const; | | const QVector<MousePattern> &mousePattern() const; | |
| const QVector<KeyPattern> &keyPattern() const; | | const QVector<KeyPattern> &keyPattern() const; | |
| | | | |
| QVector<MousePattern> &mousePattern(); | | QVector<MousePattern> &mousePattern(); | |
| QVector<KeyPattern> &keyPattern(); | | QVector<KeyPattern> &keyPattern(); | |
| | | | |
|
| bool mouseMatch( uint pattern, const QMouseEvent * ) const; | | bool mouseMatch( MousePatternCode, const QMouseEvent * ) const; | |
| bool keyMatch( uint pattern, const QKeyEvent * ) const; | | bool keyMatch( KeyPatternCode, const QKeyEvent * ) const; | |
| | | | |
| protected: | | protected: | |
| virtual bool mouseMatch( const MousePattern &, const QMouseEvent * ) co
nst; | | virtual bool mouseMatch( const MousePattern &, const QMouseEvent * ) co
nst; | |
| virtual bool keyMatch( const KeyPattern &, const QKeyEvent * ) const; | | virtual bool keyMatch( const KeyPattern &, const QKeyEvent * ) const; | |
| | | | |
| private: | | private: | |
| | | | |
| #if defined(_MSC_VER) | | #if defined(_MSC_VER) | |
| #pragma warning(push) | | #pragma warning(push) | |
| #pragma warning(disable: 4251) | | #pragma warning(disable: 4251) | |
| | | | |
| skipping to change at line 215 | | skipping to change at line 230 | |
| QVector<KeyPattern> d_keyPattern; | | QVector<KeyPattern> d_keyPattern; | |
| #if defined(_MSC_VER) | | #if defined(_MSC_VER) | |
| #pragma warning(pop) | | #pragma warning(pop) | |
| #endif | | #endif | |
| }; | | }; | |
| | | | |
| //! Compare operator | | //! Compare operator | |
| inline bool operator==( QwtEventPattern::MousePattern b1, | | inline bool operator==( QwtEventPattern::MousePattern b1, | |
| QwtEventPattern::MousePattern b2 ) | | QwtEventPattern::MousePattern b2 ) | |
| { | | { | |
|
| return b1.button == b2.button && b1.state == b2.state; | | return b1.button == b2.button && b1.modifiers == b2.modifiers; | |
| } | | } | |
| | | | |
| //! Compare operator | | //! Compare operator | |
| inline bool operator==( QwtEventPattern::KeyPattern b1, | | inline bool operator==( QwtEventPattern::KeyPattern b1, | |
| QwtEventPattern::KeyPattern b2 ) | | QwtEventPattern::KeyPattern b2 ) | |
| { | | { | |
|
| return b1.key == b2.key && b1.state == b2.state; | | return b1.key == b2.key && b1.modifiers == b2.modifiers; | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 33 change blocks. |
| 85 lines changed or deleted | | 99 lines changed or added | |
|
| qwt_interval.h | | qwt_interval.h | |
| | | | |
| skipping to change at line 14 | | skipping to change at line 14 | |
| * Copyright (C) 2002 Uwe Rathmann | | * Copyright (C) 2002 Uwe Rathmann | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_INTERVAL_H | | #ifndef QWT_INTERVAL_H | |
| #define QWT_INTERVAL_H | | #define QWT_INTERVAL_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
|
| | | #include <qmetatype.h> | |
| | | | |
| #ifndef QT_NO_DEBUG_STREAM | | #ifndef QT_NO_DEBUG_STREAM | |
| #include <qdebug.h> | | #include <qdebug.h> | |
| #endif | | #endif | |
| | | | |
| /*! | | /*! | |
| \brief A class representing an interval | | \brief A class representing an interval | |
| | | | |
| The interval is represented by 2 doubles, the lower and the upper limit. | | The interval is represented by 2 doubles, the lower and the upper limit. | |
| */ | | */ | |
| | | | |
| | | | |
| skipping to change at line 205 | | skipping to change at line 207 | |
| //! \return Upper limit of the interval | | //! \return Upper limit of the interval | |
| inline double QwtInterval::maxValue() const | | inline double QwtInterval::maxValue() const | |
| { | | { | |
| return d_maxValue; | | return d_maxValue; | |
| } | | } | |
| | | | |
| /*! | | /*! | |
| A interval is valid when minValue() <= maxValue(). | | A interval is valid when minValue() <= maxValue(). | |
| In case of QwtInterval::ExcludeBorders it is true | | In case of QwtInterval::ExcludeBorders it is true | |
| when minValue() < maxValue() | | when minValue() < maxValue() | |
|
| | | | |
| | | \return True, when the interval is valid | |
| */ | | */ | |
| inline bool QwtInterval::isValid() const | | inline bool QwtInterval::isValid() const | |
| { | | { | |
| if ( ( d_borderFlags & ExcludeBorders ) == 0 ) | | if ( ( d_borderFlags & ExcludeBorders ) == 0 ) | |
| return d_minValue <= d_maxValue; | | return d_minValue <= d_maxValue; | |
| else | | else | |
| return d_minValue < d_maxValue; | | return d_minValue < d_maxValue; | |
| } | | } | |
| | | | |
| /*! | | /*! | |
|
| Return the width of an interval | | \brief Return the width of an interval | |
| | | | |
| The width of invalid intervals is 0.0, otherwise the result is | | The width of invalid intervals is 0.0, otherwise the result is | |
| maxValue() - minValue(). | | maxValue() - minValue(). | |
| | | | |
|
| | | \return Interval width | |
| \sa isValid() | | \sa isValid() | |
| */ | | */ | |
| inline double QwtInterval::width() const | | inline double QwtInterval::width() const | |
| { | | { | |
| return isValid() ? ( d_maxValue - d_minValue ) : 0.0; | | return isValid() ? ( d_maxValue - d_minValue ) : 0.0; | |
| } | | } | |
| | | | |
| /*! | | /*! | |
|
| Intersection of two intervals | | \brief Intersection of two intervals | |
| | | | |
| | | \param other Interval to intersect with | |
| | | \return Intersection of this and other | |
| | | | |
| \sa intersect() | | \sa intersect() | |
| */ | | */ | |
| inline QwtInterval QwtInterval::operator&( | | inline QwtInterval QwtInterval::operator&( | |
|
| const QwtInterval &interval ) const | | const QwtInterval &other ) const | |
| { | | { | |
|
| return intersect( interval ); | | return intersect( other ); | |
| } | | } | |
| | | | |
| /*! | | /*! | |
| Union of two intervals | | Union of two intervals | |
|
| | | | |
| | | \param other Interval to unite with | |
| | | \return Union of this and other | |
| | | | |
| \sa unite() | | \sa unite() | |
| */ | | */ | |
| inline QwtInterval QwtInterval::operator|( | | inline QwtInterval QwtInterval::operator|( | |
|
| const QwtInterval &interval ) const | | const QwtInterval &other ) const | |
| { | | { | |
|
| return unite( interval ); | | return unite( other ); | |
| } | | } | |
| | | | |
|
| //! Compare two intervals | | /*! | |
| | | \brief Compare two intervals | |
| | | | |
| | | \param other Interval to compare with | |
| | | \return True, when this and other are equal | |
| | | */ | |
| inline bool QwtInterval::operator==( const QwtInterval &other ) const | | inline bool QwtInterval::operator==( const QwtInterval &other ) const | |
| { | | { | |
| return ( d_minValue == other.d_minValue ) && | | return ( d_minValue == other.d_minValue ) && | |
| ( d_maxValue == other.d_maxValue ) && | | ( d_maxValue == other.d_maxValue ) && | |
| ( d_borderFlags == other.d_borderFlags ); | | ( d_borderFlags == other.d_borderFlags ); | |
| } | | } | |
|
| | | /*! | |
| | | \brief Compare two intervals | |
| | | | |
|
| //! Compare two intervals | | \param other Interval to compare with | |
| | | \return True, when this and other are not equal | |
| | | */ | |
| inline bool QwtInterval::operator!=( const QwtInterval &other ) const | | inline bool QwtInterval::operator!=( const QwtInterval &other ) const | |
| { | | { | |
| return ( !( *this == other ) ); | | return ( !( *this == other ) ); | |
| } | | } | |
| | | | |
| /*! | | /*! | |
| Extend an interval | | Extend an interval | |
| | | | |
| \param value Value | | \param value Value | |
| \return Extended interval | | \return Extended interval | |
| | | | |
| skipping to change at line 291 | | skipping to change at line 314 | |
| The limits are set to interval [0.0, -1.0] | | The limits are set to interval [0.0, -1.0] | |
| \sa isValid() | | \sa isValid() | |
| */ | | */ | |
| inline void QwtInterval::invalidate() | | inline void QwtInterval::invalidate() | |
| { | | { | |
| d_minValue = 0.0; | | d_minValue = 0.0; | |
| d_maxValue = -1.0; | | d_maxValue = -1.0; | |
| } | | } | |
| | | | |
| Q_DECLARE_OPERATORS_FOR_FLAGS( QwtInterval::BorderFlags ) | | Q_DECLARE_OPERATORS_FOR_FLAGS( QwtInterval::BorderFlags ) | |
|
| | | Q_DECLARE_METATYPE( QwtInterval ) | |
| | | | |
| #ifndef QT_NO_DEBUG_STREAM | | #ifndef QT_NO_DEBUG_STREAM | |
| QWT_EXPORT QDebug operator<<( QDebug, const QwtInterval & ); | | QWT_EXPORT QDebug operator<<( QDebug, const QwtInterval & ); | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 14 change blocks. |
| 8 lines changed or deleted | | 32 lines changed or added | |
|
| qwt_knob.h | | qwt_knob.h | |
| | | | |
| skipping to change at line 15 | | skipping to change at line 15 | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_KNOB_H | | #ifndef QWT_KNOB_H | |
| #define QWT_KNOB_H | | #define QWT_KNOB_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include "qwt_abstract_slider.h" | | #include "qwt_abstract_slider.h" | |
|
| #include "qwt_abstract_scale.h" | | | |
| | | | |
| class QwtRoundScaleDraw; | | class QwtRoundScaleDraw; | |
| | | | |
| /*! | | /*! | |
| \brief The Knob Widget | | \brief The Knob Widget | |
| | | | |
|
| The QwtKnob widget imitates look and behaviour of a volume knob on a radi | | The QwtKnob widget imitates look and behavior of a volume knob on a radio | |
| o. | | . | |
| It contains a scale around the knob which is set up automatically or can | | It looks similar to QDial - not to QwtDial. | |
| be configured manually (see QwtAbstractScale). | | | |
| Automatic scrolling is enabled when the user presses a mouse | | The value range of a knob might be divided into several turns. | |
| button on the scale. For a description of signals, slots and other | | | |
| members, see QwtAbstractSlider. | | The layout of the knob depends on the knobWidth(). | |
| | | | |
| | | - width > 0 | |
| | | The diameter of the knob is fixed and the knob is aligned | |
| | | according to the alignment() flags inside of the contentsRect(). | |
| | | | |
| | | - width <= 0 | |
| | | The knob is extended to the minimum of width/height of the contentsRect | |
| | | () | |
| | | and aligned in the other direction according to alignment(). | |
| | | | |
| | | Setting a fixed knobWidth() is helpful to align several knobs with differ | |
| | | ent | |
| | | scale labels. | |
| | | | |
| \image html knob.png | | \image html knob.png | |
|
| \sa QwtAbstractSlider and QwtAbstractScale for the descriptions | | | |
| of the inherited members. | | | |
| */ | | */ | |
| | | | |
|
| class QWT_EXPORT QwtKnob : public QwtAbstractSlider, public QwtAbstractScal
e | | class QWT_EXPORT QwtKnob: public QwtAbstractSlider | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| | | | |
|
| Q_ENUMS ( KnobStyle ) | | Q_ENUMS ( KnobStyle MarkerStyle ) | |
| Q_ENUMS ( MarkerStyle ) | | | |
| | | | |
| Q_PROPERTY( KnobStyle knobStyle READ knobStyle WRITE setKnobStyle ) | | Q_PROPERTY( KnobStyle knobStyle READ knobStyle WRITE setKnobStyle ) | |
|
| Q_PROPERTY( MarkerStyle markerStyle READ markerStyle WRITE setMarkerSty
le ) | | | |
| Q_PROPERTY( int knobWidth READ knobWidth WRITE setKnobWidth ) | | Q_PROPERTY( int knobWidth READ knobWidth WRITE setKnobWidth ) | |
|
| Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth ) | | Q_PROPERTY( Qt::Alignment alignment READ alignment WRITE setAlignment ) | |
| Q_PROPERTY( double totalAngle READ totalAngle WRITE setTotalAngle ) | | Q_PROPERTY( double totalAngle READ totalAngle WRITE setTotalAngle ) | |
|
| | | Q_PROPERTY( int numTurns READ numTurns WRITE setNumTurns ) | |
| | | Q_PROPERTY( MarkerStyle markerStyle READ markerStyle WRITE setMarkerSty | |
| | | le ) | |
| Q_PROPERTY( int markerSize READ markerSize WRITE setMarkerSize ) | | Q_PROPERTY( int markerSize READ markerSize WRITE setMarkerSize ) | |
| Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth ) | | Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth ) | |
| | | | |
| public: | | public: | |
| /*! | | /*! | |
| \brief Style of the knob surface | | \brief Style of the knob surface | |
| | | | |
| Depending on the KnobStyle the surface of the knob is | | Depending on the KnobStyle the surface of the knob is | |
| filled from the brushes of the widget palette(). | | filled from the brushes of the widget palette(). | |
| | | | |
| \sa setKnobStyle(), knobStyle() | | \sa setKnobStyle(), knobStyle() | |
| */ | | */ | |
| enum KnobStyle | | enum KnobStyle | |
| { | | { | |
| //! Fill the knob with a brush from QPalette::Button. | | //! Fill the knob with a brush from QPalette::Button. | |
|
| NoStyle = -1, | | Flat, | |
| | | | |
| //! Build a gradient from QPalette::Midlight and QPalette::Button | | //! Build a gradient from QPalette::Midlight and QPalette::Button | |
| Raised, | | Raised, | |
| | | | |
| /*! | | /*! | |
| Build a gradient from QPalette::Midlight, QPalette::Button | | Build a gradient from QPalette::Midlight, QPalette::Button | |
| and QPalette::Midlight | | and QPalette::Midlight | |
| */ | | */ | |
|
| Sunken | | Sunken, | |
| | | | |
| | | /*! | |
| | | Build a radial gradient from QPalette::Button | |
| | | like it is used for QDial in various Qt styles. | |
| | | */ | |
| | | Styled | |
| }; | | }; | |
| | | | |
| /*! | | /*! | |
| \brief Marker type | | \brief Marker type | |
| | | | |
| The marker indicates the current value on the knob | | The marker indicates the current value on the knob | |
| The default setting is a Notch marker. | | The default setting is a Notch marker. | |
| | | | |
| \sa setMarkerStyle(), setMarkerSize() | | \sa setMarkerStyle(), setMarkerSize() | |
| */ | | */ | |
| enum MarkerStyle | | enum MarkerStyle | |
| { | | { | |
| //! Don't paint any marker | | //! Don't paint any marker | |
| NoMarker = -1, | | NoMarker = -1, | |
| | | | |
| //! Paint a single tick in QPalette::ButtonText color | | //! Paint a single tick in QPalette::ButtonText color | |
| Tick, | | Tick, | |
| | | | |
|
| | | //! Paint a triangle in QPalette::ButtonText color | |
| | | Triangle, | |
| | | | |
| //! Paint a circle in QPalette::ButtonText color | | //! Paint a circle in QPalette::ButtonText color | |
| Dot, | | Dot, | |
| | | | |
| /*! | | /*! | |
| Draw a raised ellipse with a gradient build from | | Draw a raised ellipse with a gradient build from | |
| QPalette::Light and QPalette::Mid | | QPalette::Light and QPalette::Mid | |
| */ | | */ | |
| Nub, | | Nub, | |
| | | | |
| /*! | | /*! | |
| Draw a sunken ellipse with a gradient build from | | Draw a sunken ellipse with a gradient build from | |
| QPalette::Light and QPalette::Mid | | QPalette::Light and QPalette::Mid | |
| */ | | */ | |
| Notch | | Notch | |
| }; | | }; | |
| | | | |
| explicit QwtKnob( QWidget* parent = NULL ); | | explicit QwtKnob( QWidget* parent = NULL ); | |
| virtual ~QwtKnob(); | | virtual ~QwtKnob(); | |
| | | | |
|
| void setKnobWidth( int w ); | | void setAlignment( Qt::Alignment ); | |
| | | Qt::Alignment alignment() const; | |
| | | | |
| | | void setKnobWidth( int ); | |
| int knobWidth() const; | | int knobWidth() const; | |
| | | | |
|
| | | void setNumTurns( int ); | |
| | | int numTurns() const; | |
| | | | |
| void setTotalAngle ( double angle ); | | void setTotalAngle ( double angle ); | |
| double totalAngle() const; | | double totalAngle() const; | |
| | | | |
| void setKnobStyle( KnobStyle ); | | void setKnobStyle( KnobStyle ); | |
| KnobStyle knobStyle() const; | | KnobStyle knobStyle() const; | |
| | | | |
| void setBorderWidth( int bw ); | | void setBorderWidth( int bw ); | |
| int borderWidth() const; | | int borderWidth() const; | |
| | | | |
| void setMarkerStyle( MarkerStyle ); | | void setMarkerStyle( MarkerStyle ); | |
| MarkerStyle markerStyle() const; | | MarkerStyle markerStyle() const; | |
| | | | |
| void setMarkerSize( int ); | | void setMarkerSize( int ); | |
| int markerSize() const; | | int markerSize() const; | |
| | | | |
| virtual QSize sizeHint() const; | | virtual QSize sizeHint() const; | |
| virtual QSize minimumSizeHint() const; | | virtual QSize minimumSizeHint() const; | |
| | | | |
| void setScaleDraw( QwtRoundScaleDraw * ); | | void setScaleDraw( QwtRoundScaleDraw * ); | |
|
| | | | |
| const QwtRoundScaleDraw *scaleDraw() const; | | const QwtRoundScaleDraw *scaleDraw() const; | |
| QwtRoundScaleDraw *scaleDraw(); | | QwtRoundScaleDraw *scaleDraw(); | |
| | | | |
|
| | | QRect knobRect() const; | |
| | | | |
| protected: | | protected: | |
| virtual void paintEvent( QPaintEvent * ); | | virtual void paintEvent( QPaintEvent * ); | |
|
| virtual void resizeEvent( QResizeEvent * ); | | | |
| virtual void changeEvent( QEvent * ); | | virtual void changeEvent( QEvent * ); | |
| | | | |
| virtual void drawKnob( QPainter *, const QRectF & ) const; | | virtual void drawKnob( QPainter *, const QRectF & ) const; | |
|
| | | | |
| | | virtual void drawFocusIndicator( QPainter * ) const; | |
| | | | |
| virtual void drawMarker( QPainter *, | | virtual void drawMarker( QPainter *, | |
| const QRectF &, double arc ) const; | | const QRectF &, double arc ) const; | |
| | | | |
|
| virtual double getValue( const QPoint &p ); | | virtual double scrolledTo( const QPoint & ) const; | |
| virtual void getScrollMode( const QPoint &, | | virtual bool isScrollPosition( const QPoint & ) const; | |
| QwtAbstractSlider::ScrollMode &, int &direction ) const; | | | |
| | | | |
| private: | | private: | |
|
| void initKnob(); | | | |
| void layoutKnob( bool update ); | | | |
| void recalcAngle(); | | | |
| | | | |
| virtual void valueChange(); | | | |
| virtual void rangeChange(); | | | |
| virtual void scaleChange(); | | | |
| | | | |
| class PrivateData; | | class PrivateData; | |
| PrivateData *d_data; | | PrivateData *d_data; | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 19 change blocks. |
| 30 lines changed or deleted | | 52 lines changed or added | |
|
| qwt_legend.h | | qwt_legend.h | |
| | | | |
| skipping to change at line 14 | | skipping to change at line 14 | |
| * Copyright (C) 2002 Uwe Rathmann | | * Copyright (C) 2002 Uwe Rathmann | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_LEGEND_H | | #ifndef QWT_LEGEND_H | |
| #define QWT_LEGEND_H | | #define QWT_LEGEND_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
|
| #include <qframe.h> | | #include "qwt_abstract_legend.h" | |
| #include <qlist.h> | | #include <qvariant.h> | |
| | | | |
| class QScrollBar; | | class QScrollBar; | |
|
| class QwtLegendItemManager; | | | |
| | | | |
| /*! | | /*! | |
| \brief The legend widget | | \brief The legend widget | |
| | | | |
| The QwtLegend widget is a tabular arrangement of legend items. Legend | | The QwtLegend widget is a tabular arrangement of legend items. Legend | |
| items might be any type of widget, but in general they will be | | items might be any type of widget, but in general they will be | |
|
| a QwtLegendItem. | | a QwtLegendLabel. | |
| | | | |
|
| \sa QwtLegendItem, QwtLegendItemManager QwtPlot | | \sa QwtLegendLabel, QwtPlotItem, QwtPlot | |
| */ | | */ | |
| | | | |
|
| class QWT_EXPORT QwtLegend : public QFrame | | class QWT_EXPORT QwtLegend : public QwtAbstractLegend | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| | | | |
| public: | | public: | |
|
| /*! | | | |
| \brief Interaction mode for the legend items | | | |
| | | | |
| The default is QwtLegend::ReadOnlyItem. | | | |
| | | | |
| \sa setItemMode(), itemMode(), QwtLegendItem::IdentifierMode | | | |
| QwtLegendItem::clicked(), QwtLegendItem::checked(), | | | |
| QwtPlot::legendClicked(), QwtPlot::legendChecked() | | | |
| */ | | | |
| | | | |
| enum LegendItemMode | | | |
| { | | | |
| //! The legend item is not interactive, like a label | | | |
| ReadOnlyItem, | | | |
| | | | |
| //! The legend item is clickable, like a push button | | | |
| ClickableItem, | | | |
| | | | |
| //! The legend item is checkable, like a checkable button | | | |
| CheckableItem | | | |
| }; | | | |
| | | | |
| explicit QwtLegend( QWidget *parent = NULL ); | | explicit QwtLegend( QWidget *parent = NULL ); | |
| virtual ~QwtLegend(); | | virtual ~QwtLegend(); | |
| | | | |
|
| void setItemMode( LegendItemMode ); | | void setMaxColumns( uint numColums ); | |
| LegendItemMode itemMode() const; | | uint maxColumns() const; | |
| | | | |
| | | void setDefaultItemMode( QwtLegendData::Mode ); | |
| | | QwtLegendData::Mode defaultItemMode() const; | |
| | | | |
| QWidget *contentsWidget(); | | QWidget *contentsWidget(); | |
| const QWidget *contentsWidget() const; | | const QWidget *contentsWidget() const; | |
| | | | |
|
| void insert( const QwtLegendItemManager *, QWidget * ); | | QWidget *legendWidget( const QVariant & ) const; | |
| void remove( const QwtLegendItemManager * ); | | QList<QWidget *> legendWidgets( const QVariant & ) const; | |
| | | | |
|
| QWidget *find( const QwtLegendItemManager * ) const; | | QVariant itemInfo( const QWidget * ) const; | |
| QwtLegendItemManager *find( const QWidget * ) const; | | | |
| | | | |
| virtual QList<QWidget *> legendItems() const; | | | |
| | | | |
| void clear(); | | | |
| | | | |
| bool isEmpty() const; | | | |
| uint itemCount() const; | | | |
| | | | |
| virtual bool eventFilter( QObject *, QEvent * ); | | virtual bool eventFilter( QObject *, QEvent * ); | |
| | | | |
| virtual QSize sizeHint() const; | | virtual QSize sizeHint() const; | |
| virtual int heightForWidth( int w ) const; | | virtual int heightForWidth( int w ) const; | |
| | | | |
| QScrollBar *horizontalScrollBar() const; | | QScrollBar *horizontalScrollBar() const; | |
| QScrollBar *verticalScrollBar() const; | | QScrollBar *verticalScrollBar() const; | |
| | | | |
|
| | | virtual void renderLegend( QPainter *, | |
| | | const QRectF &, bool fillBackground ) const; | |
| | | | |
| | | virtual void renderItem( QPainter *, | |
| | | const QWidget *, const QRectF &, bool fillBackground ) const; | |
| | | | |
| | | virtual bool isEmpty() const; | |
| | | virtual int scrollExtent( Qt::Orientation ) const; | |
| | | | |
| | | Q_SIGNALS: | |
| | | /*! | |
| | | A signal which is emitted when the user has clicked on | |
| | | a legend label, which is in QwtLegendData::Clickable mode. | |
| | | | |
| | | \param itemInfo Info for the item item of the | |
| | | selected legend item | |
| | | \param index Index of the legend label in the list of widgets | |
| | | that are associated with the plot item | |
| | | | |
| | | \note clicks are disabled as default | |
| | | \sa setDefaultItemMode(), defaultItemMode(), QwtPlot::itemToInfo() | |
| | | */ | |
| | | void clicked( const QVariant &itemInfo, int index ); | |
| | | | |
| | | /*! | |
| | | A signal which is emitted when the user has clicked on | |
| | | a legend label, which is in QwtLegendData::Checkable mode | |
| | | | |
| | | \param itemInfo Info for the item of the | |
| | | selected legend label | |
| | | \param index Index of the legend label in the list of widgets | |
| | | that are associated with the plot item | |
| | | \param on True when the legend label is checked | |
| | | | |
| | | \note clicks are disabled as default | |
| | | \sa setDefaultItemMode(), defaultItemMode(), QwtPlot::itemToInfo() | |
| | | */ | |
| | | void checked( const QVariant &itemInfo, bool on, int index ); | |
| | | | |
| | | public Q_SLOTS: | |
| | | virtual void updateLegend( const QVariant &, | |
| | | const QList<QwtLegendData> & ); | |
| | | | |
| | | protected Q_SLOTS: | |
| | | void itemClicked(); | |
| | | void itemChecked( bool ); | |
| | | | |
| protected: | | protected: | |
|
| virtual void layoutContents(); | | virtual QWidget *createWidget( const QwtLegendData & ) const; | |
| | | virtual void updateWidget( QWidget *widget, const QwtLegendData &data ) | |
| | | ; | |
| | | | |
| private: | | private: | |
|
| | | void updateTabOrder(); | |
| | | | |
| class PrivateData; | | class PrivateData; | |
| PrivateData *d_data; | | PrivateData *d_data; | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 12 change blocks. |
| 42 lines changed or deleted | | 65 lines changed or added | |
|
| qwt_math.h | | qwt_math.h | |
| | | | |
| skipping to change at line 26 | | skipping to change at line 26 | |
| /* | | /* | |
| Microsoft says: | | Microsoft says: | |
| | | | |
| Define _USE_MATH_DEFINES before including math.h to expose these macro | | Define _USE_MATH_DEFINES before including math.h to expose these macro | |
| definitions for common math constants. These are placed under an #ifdef | | definitions for common math constants. These are placed under an #ifdef | |
| since these commonly-defined names are not part of the C/C++ standards. | | since these commonly-defined names are not part of the C/C++ standards. | |
| */ | | */ | |
| #define _USE_MATH_DEFINES 1 | | #define _USE_MATH_DEFINES 1 | |
| #endif | | #endif | |
| | | | |
|
| #include <qpoint.h> | | | |
| #include <qmath.h> | | #include <qmath.h> | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| | | | |
|
| #ifndef LOG10_2 | | #ifndef M_PI_2 | |
| #define LOG10_2 0.30102999566398119802 /* log10(2) */ | | // For Qt <= 4.8.4 M_PI_2 is not known by MinGW-w64 | |
| #endif | | // when compiling with -std=c++11 | |
| | | #define M_PI_2 (1.57079632679489661923) | |
| #ifndef LOG10_3 | | | |
| #define LOG10_3 0.47712125471966243540 /* log10(3) */ | | | |
| #endif | | | |
| | | | |
| #ifndef LOG10_5 | | | |
| #define LOG10_5 0.69897000433601885749 /* log10(5) */ | | | |
| #endif | | | |
| | | | |
| #ifndef M_2PI | | | |
| #define M_2PI 6.28318530717958623200 /* 2 pi */ | | | |
| #endif | | #endif | |
| | | | |
| #ifndef LOG_MIN | | #ifndef LOG_MIN | |
|
| //! Mininum value for logarithmic scales | | //! Minimum value for logarithmic scales | |
| #define LOG_MIN 1.0e-100 | | #define LOG_MIN 1.0e-100 | |
| #endif | | #endif | |
| | | | |
| #ifndef LOG_MAX | | #ifndef LOG_MAX | |
| //! Maximum value for logarithmic scales | | //! Maximum value for logarithmic scales | |
| #define LOG_MAX 1.0e100 | | #define LOG_MAX 1.0e100 | |
| #endif | | #endif | |
| | | | |
|
| #ifndef M_E | | | |
| #define M_E 2.7182818284590452354 /* e */ | | | |
| #endif | | | |
| | | | |
| #ifndef M_LOG2E | | | |
| #define M_LOG2E 1.4426950408889634074 /* log_2 e */ | | | |
| #endif | | | |
| | | | |
| #ifndef M_LOG10E | | | |
| #define M_LOG10E 0.43429448190325182765 /* log_10 e */ | | | |
| #endif | | | |
| | | | |
| #ifndef M_LN2 | | | |
| #define M_LN2 0.69314718055994530942 /* log_e 2 */ | | | |
| #endif | | | |
| | | | |
| #ifndef M_LN10 | | | |
| #define M_LN10 2.30258509299404568402 /* log_e 10 */ | | | |
| #endif | | | |
| | | | |
| #ifndef M_PI | | | |
| #define M_PI 3.14159265358979323846 /* pi */ | | | |
| #endif | | | |
| | | | |
| #ifndef M_PI_2 | | | |
| #define M_PI_2 1.57079632679489661923 /* pi/2 */ | | | |
| #endif | | | |
| | | | |
| #ifndef M_PI_4 | | | |
| #define M_PI_4 0.78539816339744830962 /* pi/4 */ | | | |
| #endif | | | |
| | | | |
| #ifndef M_1_PI | | | |
| #define M_1_PI 0.31830988618379067154 /* 1/pi */ | | | |
| #endif | | | |
| | | | |
| #ifndef M_2_PI | | | |
| #define M_2_PI 0.63661977236758134308 /* 2/pi */ | | | |
| #endif | | | |
| | | | |
| #ifndef M_2_SQRTPI | | | |
| #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ | | | |
| #endif | | | |
| | | | |
| #ifndef M_SQRT2 | | | |
| #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ | | | |
| #endif | | | |
| | | | |
| #ifndef M_SQRT1_2 | | | |
| #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ | | | |
| #endif | | | |
| | | | |
| QWT_EXPORT double qwtGetMin( const double *array, int size ); | | QWT_EXPORT double qwtGetMin( const double *array, int size ); | |
| QWT_EXPORT double qwtGetMax( const double *array, int size ); | | QWT_EXPORT double qwtGetMax( const double *array, int size ); | |
| | | | |
|
| | | QWT_EXPORT double qwtNormalizeRadians( double radians ); | |
| | | QWT_EXPORT double qwtNormalizeDegrees( double degrees ); | |
| | | | |
| /*! | | /*! | |
| \brief Compare 2 values, relative to an interval | | \brief Compare 2 values, relative to an interval | |
| | | | |
| Values are "equal", when : | | Values are "equal", when : | |
| \f$\cdot value2 - value1 <= abs(intervalSize * 10e^{-6})\f$ | | \f$\cdot value2 - value1 <= abs(intervalSize * 10e^{-6})\f$ | |
| | | | |
| \param value1 First value to compare | | \param value1 First value to compare | |
| \param value2 Second value to compare | | \param value2 Second value to compare | |
| \param intervalSize interval size | | \param intervalSize interval size | |
| | | | |
| | | | |
| skipping to change at line 163 | | skipping to change at line 103 | |
| else | | else | |
| return 0; | | return 0; | |
| } | | } | |
| | | | |
| //! Return the square of a number | | //! Return the square of a number | |
| inline double qwtSqr( double x ) | | inline double qwtSqr( double x ) | |
| { | | { | |
| return x * x; | | return x * x; | |
| } | | } | |
| | | | |
|
| //! Like qRound, but without converting the result to an int | | //! Approximation of arc tangent ( error below 0,005 radians ) | |
| inline double qwtRoundF(double d) | | inline double qwtFastAtan( double x ) | |
| { | | { | |
|
| return ::floor( d + 0.5 ); | | if ( x < -1.0 ) | |
| | | return -M_PI_2 - x / ( x * x + 0.28 ); | |
| | | | |
| | | if ( x > 1.0 ) | |
| | | return M_PI_2 - x / ( x * x + 0.28 ); | |
| | | | |
| | | return x / ( 1.0 + x * x * 0.28 ); | |
| | | } | |
| | | | |
| | | //! Approximation of arc tangent ( error below 0,005 radians ) | |
| | | inline double qwtFastAtan2( double y, double x ) | |
| | | { | |
| | | if ( x > 0 ) | |
| | | return qwtFastAtan( y / x ); | |
| | | | |
| | | if ( x < 0 ) | |
| | | { | |
| | | const double d = qwtFastAtan( y / x ); | |
| | | return ( y >= 0 ) ? d + M_PI : d - M_PI; | |
| | | } | |
| | | | |
| | | if ( y < 0.0 ) | |
| | | return -M_PI_2; | |
| | | | |
| | | if ( y > 0.0 ) | |
| | | return M_PI_2; | |
| | | | |
| | | return 0.0; | |
| } | | } | |
| | | | |
|
| //! Like qFloor, but without converting the result to an int | | // Translate degrees into radians | |
| inline double qwtFloorF(double d) | | inline double qwtRadians( double degrees ) | |
| { | | { | |
|
| return ::floor( d ); | | return degrees * M_PI / 180.0; | |
| } | | } | |
| | | | |
|
| //! Like qCeil, but without converting the result to an int | | // Translate radians into degrees | |
| inline double qwtCeilF(double d) | | inline double qwtDegrees( double degrees ) | |
| { | | { | |
|
| return ::ceil( d ); | | return degrees * 180.0 / M_PI; | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 11 change blocks. |
| 77 lines changed or deleted | | 44 lines changed or added | |
|
| qwt_null_paintdevice.h | | qwt_null_paintdevice.h | |
| | | | |
| skipping to change at line 21 | | skipping to change at line 21 | |
| #define QWT_NULL_PAINT_DEVICE_H 1 | | #define QWT_NULL_PAINT_DEVICE_H 1 | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include <qpaintdevice.h> | | #include <qpaintdevice.h> | |
| #include <qpaintengine.h> | | #include <qpaintengine.h> | |
| | | | |
| /*! | | /*! | |
| \brief A null paint device doing nothing | | \brief A null paint device doing nothing | |
| | | | |
| Sometimes important layout/rendering geometries are not | | Sometimes important layout/rendering geometries are not | |
|
| available or changable from the public Qt class interface. | | available or changeable from the public Qt class interface. | |
| ( f.e hidden in the style implementation ). | | ( f.e hidden in the style implementation ). | |
| | | | |
| QwtNullPaintDevice can be used to manipulate or filter out | | QwtNullPaintDevice can be used to manipulate or filter out | |
|
| these informations by analyzing the stream of paint primitives. | | this information by analyzing the stream of paint primitives. | |
| | | | |
| F.e. QwtNullPaintDevice is used by QwtPlotCanvas to identify | | F.e. QwtNullPaintDevice is used by QwtPlotCanvas to identify | |
| styled backgrounds with rounded corners. | | styled backgrounds with rounded corners. | |
| */ | | */ | |
| | | | |
| class QWT_EXPORT QwtNullPaintDevice: public QPaintDevice | | class QWT_EXPORT QwtNullPaintDevice: public QPaintDevice | |
| { | | { | |
| public: | | public: | |
|
| QwtNullPaintDevice( QPaintEngine::PaintEngineFeatures ); | | /*! | |
| QwtNullPaintDevice( const QSize &size, | | \brief Render mode | |
| QPaintEngine::PaintEngineFeatures ); | | | |
| | | | |
|
| | | \sa setMode(), mode() | |
| | | */ | |
| | | enum Mode | |
| | | { | |
| | | /*! | |
| | | All vector graphic primitives are painted by | |
| | | the corresponding draw methods | |
| | | */ | |
| | | NormalMode, | |
| | | | |
| | | /*! | |
| | | Vector graphic primitives ( beside polygons ) are mapped to a QP | |
| | | ainterPath | |
| | | and are painted by drawPath. In PathMode mode | |
| | | only a few draw methods are called: | |
| | | | |
| | | - drawPath() | |
| | | - drawPixmap() | |
| | | - drawImage() | |
| | | - drawPolygon() | |
| | | */ | |
| | | PolygonPathMode, | |
| | | | |
| | | /*! | |
| | | Vector graphic primitives are mapped to a QPainterPath | |
| | | and are painted by drawPath. In PathMode mode | |
| | | only a few draw methods are called: | |
| | | | |
| | | - drawPath() | |
| | | - drawPixmap() | |
| | | - drawImage() | |
| | | */ | |
| | | PathMode | |
| | | }; | |
| | | | |
| | | QwtNullPaintDevice(); | |
| virtual ~QwtNullPaintDevice(); | | virtual ~QwtNullPaintDevice(); | |
| | | | |
|
| void setSize( const QSize &); | | void setMode( Mode ); | |
| QSize size() const; | | Mode mode() const; | |
| | | | |
| virtual QPaintEngine *paintEngine() const; | | virtual QPaintEngine *paintEngine() const; | |
|
| | | | |
| virtual int metric( PaintDeviceMetric metric ) const; | | virtual int metric( PaintDeviceMetric metric ) const; | |
| | | | |
| virtual void drawRects(const QRect *, int ); | | virtual void drawRects(const QRect *, int ); | |
| virtual void drawRects(const QRectF *, int ); | | virtual void drawRects(const QRectF *, int ); | |
| | | | |
| virtual void drawLines(const QLine *, int ); | | virtual void drawLines(const QLine *, int ); | |
| virtual void drawLines(const QLineF *, int ); | | virtual void drawLines(const QLineF *, int ); | |
| | | | |
| virtual void drawEllipse(const QRectF &); | | virtual void drawEllipse(const QRectF &); | |
| virtual void drawEllipse(const QRect &); | | virtual void drawEllipse(const QRect &); | |
| | | | |
| skipping to change at line 79 | | skipping to change at line 114 | |
| virtual void drawTextItem(const QPointF &, const QTextItem &); | | virtual void drawTextItem(const QPointF &, const QTextItem &); | |
| | | | |
| virtual void drawTiledPixmap(const QRectF &, | | virtual void drawTiledPixmap(const QRectF &, | |
| const QPixmap &, const QPointF &s); | | const QPixmap &, const QPointF &s); | |
| | | | |
| virtual void drawImage(const QRectF &, | | virtual void drawImage(const QRectF &, | |
| const QImage &, const QRectF &, Qt::ImageConversionFlags ); | | const QImage &, const QRectF &, Qt::ImageConversionFlags ); | |
| | | | |
| virtual void updateState( const QPaintEngineState &state ); | | virtual void updateState( const QPaintEngineState &state ); | |
| | | | |
|
| private: | | protected: | |
| void init( QPaintEngine::PaintEngineFeatures ); | | //! \return Size needed to implement metric() | |
| | | virtual QSize sizeMetrics() const = 0; | |
| | | | |
|
| | | private: | |
| class PaintEngine; | | class PaintEngine; | |
| PaintEngine *d_engine; | | PaintEngine *d_engine; | |
| | | | |
| class PrivateData; | | class PrivateData; | |
| PrivateData *d_data; | | PrivateData *d_data; | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 8 change blocks. |
| 9 lines changed or deleted | | 47 lines changed or added | |
|
| qwt_painter.h | | qwt_painter.h | |
| | | | |
| skipping to change at line 19 | | skipping to change at line 19 | |
| | | | |
| #ifndef QWT_PAINTER_H | | #ifndef QWT_PAINTER_H | |
| #define QWT_PAINTER_H | | #define QWT_PAINTER_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| | | | |
| #include <qpoint.h> | | #include <qpoint.h> | |
| #include <qrect.h> | | #include <qrect.h> | |
| #include <qpen.h> | | #include <qpen.h> | |
| #include <qline.h> | | #include <qline.h> | |
|
| | | #include <qpalette.h> | |
| | | | |
| class QPainter; | | class QPainter; | |
| class QBrush; | | class QBrush; | |
| class QColor; | | class QColor; | |
| class QWidget; | | class QWidget; | |
| class QPolygonF; | | class QPolygonF; | |
| class QRectF; | | class QRectF; | |
| class QImage; | | class QImage; | |
| class QPixmap; | | class QPixmap; | |
| class QwtScaleMap; | | class QwtScaleMap; | |
| class QwtColorMap; | | class QwtColorMap; | |
| class QwtInterval; | | class QwtInterval; | |
| | | | |
|
| class QPalette; | | | |
| class QTextDocument; | | class QTextDocument; | |
| class QPainterPath; | | class QPainterPath; | |
| | | | |
| /*! | | /*! | |
| \brief A collection of QPainter workarounds | | \brief A collection of QPainter workarounds | |
| */ | | */ | |
| class QWT_EXPORT QwtPainter | | class QWT_EXPORT QwtPainter | |
| { | | { | |
| public: | | public: | |
| static void setPolylineSplitting( bool ); | | static void setPolylineSplitting( bool ); | |
| | | | |
| skipping to change at line 72 | | skipping to change at line 72 | |
| static void drawRect( QPainter *, const QRectF &rect ); | | static void drawRect( QPainter *, const QRectF &rect ); | |
| static void fillRect( QPainter *, const QRectF &, const QBrush & ); | | static void fillRect( QPainter *, const QRectF &, const QBrush & ); | |
| | | | |
| static void drawEllipse( QPainter *, const QRectF & ); | | static void drawEllipse( QPainter *, const QRectF & ); | |
| static void drawPie( QPainter *, const QRectF & r, int a, int alen ); | | static void drawPie( QPainter *, const QRectF & r, int a, int alen ); | |
| | | | |
| static void drawLine( QPainter *, double x1, double y1, double x2, doub
le y2 ); | | static void drawLine( QPainter *, double x1, double y1, double x2, doub
le y2 ); | |
| static void drawLine( QPainter *, const QPointF &p1, const QPointF &p2
); | | static void drawLine( QPainter *, const QPointF &p1, const QPointF &p2
); | |
| static void drawLine( QPainter *, const QLineF & ); | | static void drawLine( QPainter *, const QLineF & ); | |
| | | | |
|
| static void drawPolygon( QPainter *, const QPolygonF &pa ); | | static void drawPolygon( QPainter *, const QPolygonF & ); | |
| static void drawPolyline( QPainter *, const QPolygonF &pa ); | | static void drawPolyline( QPainter *, const QPolygonF & ); | |
| static void drawPolyline( QPainter *, const QPointF *, int pointCount )
; | | static void drawPolyline( QPainter *, const QPointF *, int pointCount )
; | |
| | | | |
|
| | | static void drawPolygon( QPainter *, const QPolygon & ); | |
| | | static void drawPolyline( QPainter *, const QPolygon & ); | |
| | | static void drawPolyline( QPainter *, const QPoint *, int pointCount ); | |
| | | | |
| | | static void drawPoint( QPainter *, const QPoint & ); | |
| | | static void drawPoints( QPainter *, const QPolygon & ); | |
| | | static void drawPoints( QPainter *, const QPoint *, int pointCount ); | |
| | | | |
| static void drawPoint( QPainter *, double x, double y ); | | static void drawPoint( QPainter *, double x, double y ); | |
| static void drawPoint( QPainter *, const QPointF & ); | | static void drawPoint( QPainter *, const QPointF & ); | |
|
| | | static void drawPoints( QPainter *, const QPolygonF & ); | |
| | | static void drawPoints( QPainter *, const QPointF *, int pointCount ); | |
| | | | |
| static void drawPath( QPainter *, const QPainterPath & ); | | static void drawPath( QPainter *, const QPainterPath & ); | |
| static void drawImage( QPainter *, const QRectF &, const QImage & ); | | static void drawImage( QPainter *, const QRectF &, const QImage & ); | |
| static void drawPixmap( QPainter *, const QRectF &, const QPixmap & ); | | static void drawPixmap( QPainter *, const QRectF &, const QPixmap & ); | |
| | | | |
|
| | | static void drawRoundFrame( QPainter *, | |
| | | const QRectF &, const QPalette &, int lineWidth, int frameStyle ); | |
| | | | |
| static void drawRoundedFrame( QPainter *, | | static void drawRoundedFrame( QPainter *, | |
| const QRectF &, double xRadius, double yRadius, | | const QRectF &, double xRadius, double yRadius, | |
| const QPalette &, int lineWidth, int frameStyle ); | | const QPalette &, int lineWidth, int frameStyle ); | |
| | | | |
|
| static void drawFocusRect( QPainter *, QWidget * ); | | static void drawFrame( QPainter *, const QRectF &rect, | |
| static void drawFocusRect( QPainter *, QWidget *, const QRect & ); | | const QPalette &palette, QPalette::ColorRole foregroundRole, | |
| | | int lineWidth, int midLineWidth, int frameStyle ); | |
| | | | |
| | | static void drawFocusRect( QPainter *, const QWidget * ); | |
| | | static void drawFocusRect( QPainter *, const QWidget *, const QRect & ) | |
| | | ; | |
| | | | |
| static void drawColorBar( QPainter *painter, | | static void drawColorBar( QPainter *painter, | |
| const QwtColorMap &, const QwtInterval &, | | const QwtColorMap &, const QwtInterval &, | |
| const QwtScaleMap &, Qt::Orientation, const QRectF & ); | | const QwtScaleMap &, Qt::Orientation, const QRectF & ); | |
| | | | |
| static bool isAligning( QPainter *painter ); | | static bool isAligning( QPainter *painter ); | |
|
| | | static bool isX11GraphicsSystem(); | |
| | | | |
| | | static void fillPixmap( const QWidget *, | |
| | | QPixmap &, const QPoint &offset = QPoint() ); | |
| | | | |
| | | static void drawBackgound( QPainter *painter, | |
| | | const QRectF &rect, const QWidget *widget ); | |
| | | | |
| | | static QPixmap backingStore( QWidget *, const QSize & ); | |
| | | | |
| private: | | private: | |
| static bool d_polylineSplitting; | | static bool d_polylineSplitting; | |
| static bool d_roundingAlignment; | | static bool d_roundingAlignment; | |
| }; | | }; | |
| | | | |
| //! Wrapper for QPainter::drawPoint() | | //! Wrapper for QPainter::drawPoint() | |
| inline void QwtPainter::drawPoint( QPainter *painter, double x, double y ) | | inline void QwtPainter::drawPoint( QPainter *painter, double x, double y ) | |
| { | | { | |
| QwtPainter::drawPoint( painter, QPointF( x, y ) ); | | QwtPainter::drawPoint( painter, QPointF( x, y ) ); | |
| } | | } | |
| | | | |
|
| | | //! Wrapper for QPainter::drawPoints() | |
| | | inline void QwtPainter::drawPoints( QPainter *painter, const QPolygon &poly | |
| | | gon ) | |
| | | { | |
| | | drawPoints( painter, polygon.data(), polygon.size() ); | |
| | | } | |
| | | | |
| | | //! Wrapper for QPainter::drawPoints() | |
| | | inline void QwtPainter::drawPoints( QPainter *painter, const QPolygonF &pol | |
| | | ygon ) | |
| | | { | |
| | | drawPoints( painter, polygon.data(), polygon.size() ); | |
| | | } | |
| | | | |
| //! Wrapper for QPainter::drawLine() | | //! Wrapper for QPainter::drawLine() | |
| inline void QwtPainter::drawLine( QPainter *painter, | | inline void QwtPainter::drawLine( QPainter *painter, | |
| double x1, double y1, double x2, double y2 ) | | double x1, double y1, double x2, double y2 ) | |
| { | | { | |
| QwtPainter::drawLine( painter, QPointF( x1, y1 ), QPointF( x2, y2 ) ); | | QwtPainter::drawLine( painter, QPointF( x1, y1 ), QPointF( x2, y2 ) ); | |
| } | | } | |
| | | | |
| //! Wrapper for QPainter::drawLine() | | //! Wrapper for QPainter::drawLine() | |
| inline void QwtPainter::drawLine( QPainter *painter, const QLineF &line ) | | inline void QwtPainter::drawLine( QPainter *painter, const QLineF &line ) | |
| { | | { | |
| QwtPainter::drawLine( painter, line.p1(), line.p2() ); | | QwtPainter::drawLine( painter, line.p1(), line.p2() ); | |
| } | | } | |
| | | | |
| /*! | | /*! | |
|
| Returns whether line splitting for the raster paint engine is enabled. | | \return True, when line splitting for the raster paint engine is enabled. | |
| \sa setPolylineSplitting() | | \sa setPolylineSplitting() | |
| */ | | */ | |
| inline bool QwtPainter::polylineSplitting() | | inline bool QwtPainter::polylineSplitting() | |
| { | | { | |
| return d_polylineSplitting; | | return d_polylineSplitting; | |
| } | | } | |
| | | | |
| /*! | | /*! | |
|
| Returns whether coordinates should be rounded, before they are painted | | Check whether coordinates should be rounded, before they are painted | |
| to a paint engine that floors to integer values. For other paint engines | | to a paint engine that rounds to integer values. For other paint engines | |
| this ( Pdf, SVG ), this flag has no effect. | | ( PDF, SVG ), this flag has no effect. | |
| | | | |
|
| | | \return True, when rounding is enabled | |
| \sa setRoundingAlignment(), isAligning() | | \sa setRoundingAlignment(), isAligning() | |
| */ | | */ | |
| inline bool QwtPainter::roundingAlignment() | | inline bool QwtPainter::roundingAlignment() | |
| { | | { | |
| return d_roundingAlignment; | | return d_roundingAlignment; | |
| } | | } | |
| | | | |
| /*! | | /*! | |
| \return roundingAlignment() && isAligning(painter); | | \return roundingAlignment() && isAligning(painter); | |
| \param painter Painter | | \param painter Painter | |
| | | | |
End of changes. 12 change blocks. |
| 9 lines changed or deleted | | 51 lines changed or added | |
|
| qwt_picker.h | | qwt_picker.h | |
| | | | |
| skipping to change at line 20 | | skipping to change at line 20 | |
| #ifndef QWT_PICKER | | #ifndef QWT_PICKER | |
| #define QWT_PICKER 1 | | #define QWT_PICKER 1 | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include "qwt_text.h" | | #include "qwt_text.h" | |
| #include "qwt_event_pattern.h" | | #include "qwt_event_pattern.h" | |
| #include <qobject.h> | | #include <qobject.h> | |
| #include <qpen.h> | | #include <qpen.h> | |
| #include <qfont.h> | | #include <qfont.h> | |
| #include <qrect.h> | | #include <qrect.h> | |
|
| | | #include <qpainterpath.h> | |
| | | | |
| class QWidget; | | class QWidget; | |
| class QMouseEvent; | | class QMouseEvent; | |
| class QWheelEvent; | | class QWheelEvent; | |
| class QKeyEvent; | | class QKeyEvent; | |
| class QwtPickerMachine; | | class QwtPickerMachine; | |
|
| | | class QwtWidgetOverlay; | |
| | | | |
| /*! | | /*! | |
| \brief QwtPicker provides selections on a widget | | \brief QwtPicker provides selections on a widget | |
| | | | |
| QwtPicker filters all enter, leave, mouse and keyboard events of a widget | | QwtPicker filters all enter, leave, mouse and keyboard events of a widget | |
| and translates them into an array of selected points. | | and translates them into an array of selected points. | |
| | | | |
| The way how the points are collected depends on type of state machine | | The way how the points are collected depends on type of state machine | |
| that is connected to the picker. Qwt offers a couple of predefined | | that is connected to the picker. Qwt offers a couple of predefined | |
| state machines for selecting: | | state machines for selecting: | |
| | | | |
| skipping to change at line 50 | | skipping to change at line 52 | |
| QwtPickerClickPointMachine, QwtPickerDragPointMachine | | QwtPickerClickPointMachine, QwtPickerDragPointMachine | |
| - Rectangles\n | | - Rectangles\n | |
| QwtPickerClickRectMachine, QwtPickerDragRectMachine | | QwtPickerClickRectMachine, QwtPickerDragRectMachine | |
| - Polygons\n | | - Polygons\n | |
| QwtPickerPolygonMachine | | QwtPickerPolygonMachine | |
| | | | |
| While these state machines cover the most common ways to collect points | | While these state machines cover the most common ways to collect points | |
| it is also possible to implement individual machines as well. | | it is also possible to implement individual machines as well. | |
| | | | |
| QwtPicker translates the picked points into a selection using the | | QwtPicker translates the picked points into a selection using the | |
|
| adjustedPoints method. adjustedPoints is intended to be reimplemented | | adjustedPoints() method. adjustedPoints() is intended to be reimplemented | |
| to fixup the selection according to application specific requirements. | | to fix up the selection according to application specific requirements. | |
| (F.e. when an application accepts rectangles of a fixed aspect ratio only
.) | | (F.e. when an application accepts rectangles of a fixed aspect ratio only
.) | |
| | | | |
| Optionally QwtPicker support the process of collecting points by a | | Optionally QwtPicker support the process of collecting points by a | |
|
| rubberband and tracker displaying a text for the current mouse | | rubber band and tracker displaying a text for the current mouse | |
| position. | | position. | |
| | | | |
| \par Example | | \par Example | |
| \verbatim #include <qwt_picker.h> | | \verbatim #include <qwt_picker.h> | |
| #include <qwt_picker_machine.h> | | #include <qwt_picker_machine.h> | |
| | | | |
| QwtPicker *picker = new QwtPicker(widget); | | QwtPicker *picker = new QwtPicker(widget); | |
| picker->setStateMachine(new QwtPickerDragRectMachine); | | picker->setStateMachine(new QwtPickerDragRectMachine); | |
| picker->setTrackerMode(QwtPicker::ActiveOnly); | | picker->setTrackerMode(QwtPicker::ActiveOnly); | |
| picker->setRubberBand(QwtPicker::RectRubberBand); \endverbatim\n | | picker->setRubberBand(QwtPicker::RectRubberBand); \endverbatim\n | |
| | | | |
| skipping to change at line 81 | | skipping to change at line 83 | |
| - append()\n | | - append()\n | |
| Add a new point | | Add a new point | |
| - move() \n | | - move() \n | |
| Change the position of the last point. | | Change the position of the last point. | |
| - remove()\n | | - remove()\n | |
| Remove the last point. | | Remove the last point. | |
| - end()\n | | - end()\n | |
| Terminate the selection and call accept to validate the picked points. | | Terminate the selection and call accept to validate the picked points. | |
| | | | |
| The picker is active (isActive()), between begin() and end(). | | The picker is active (isActive()), between begin() and end(). | |
|
| In active state the rubberband is displayed, and the tracker is visible | | In active state the rubber band is displayed, and the tracker is visible | |
| in case of trackerMode is ActiveOnly or AlwaysOn. | | in case of trackerMode is ActiveOnly or AlwaysOn. | |
| | | | |
| The cursor can be moved using the arrow keys. All selections can be abort
ed | | The cursor can be moved using the arrow keys. All selections can be abort
ed | |
| using the abort key. (QwtEventPattern::KeyPatternCode) | | using the abort key. (QwtEventPattern::KeyPatternCode) | |
| | | | |
| \warning In case of QWidget::NoFocus the focus policy of the observed | | \warning In case of QWidget::NoFocus the focus policy of the observed | |
| widget is set to QWidget::WheelFocus and mouse tracking | | widget is set to QWidget::WheelFocus and mouse tracking | |
| will be manipulated while the picker is active, | | will be manipulated while the picker is active, | |
| or if trackerMode() is AlwayOn. | | or if trackerMode() is AlwayOn. | |
| */ | | */ | |
| | | | |
| class QWT_EXPORT QwtPicker: public QObject, public QwtEventPattern | | class QWT_EXPORT QwtPicker: public QObject, public QwtEventPattern | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| | | | |
|
| Q_ENUMS( RubberBand ) | | Q_ENUMS( RubberBand DisplayMode ResizeMode ) | |
| Q_ENUMS( DisplayMode ) | | | |
| Q_ENUMS( ResizeMode ) | | | |
| | | | |
| Q_PROPERTY( bool isEnabled READ isEnabled WRITE setEnabled ) | | Q_PROPERTY( bool isEnabled READ isEnabled WRITE setEnabled ) | |
| Q_PROPERTY( ResizeMode resizeMode READ resizeMode WRITE setResizeMode ) | | Q_PROPERTY( ResizeMode resizeMode READ resizeMode WRITE setResizeMode ) | |
| | | | |
| Q_PROPERTY( DisplayMode trackerMode READ trackerMode WRITE setTrackerMo
de ) | | Q_PROPERTY( DisplayMode trackerMode READ trackerMode WRITE setTrackerMo
de ) | |
| Q_PROPERTY( QPen trackerPen READ trackerPen WRITE setTrackerPen ) | | Q_PROPERTY( QPen trackerPen READ trackerPen WRITE setTrackerPen ) | |
| Q_PROPERTY( QFont trackerFont READ trackerFont WRITE setTrackerFont ) | | Q_PROPERTY( QFont trackerFont READ trackerFont WRITE setTrackerFont ) | |
| | | | |
| Q_PROPERTY( RubberBand rubberBand READ rubberBand WRITE setRubberBand ) | | Q_PROPERTY( RubberBand rubberBand READ rubberBand WRITE setRubberBand ) | |
| Q_PROPERTY( QPen rubberBandPen READ rubberBandPen WRITE setRubberBandPe
n ) | | Q_PROPERTY( QPen rubberBandPen READ rubberBandPen WRITE setRubberBandPe
n ) | |
| | | | |
| public: | | public: | |
| /*! | | /*! | |
|
| Rubberband style | | Rubber band style | |
| | | | |
| The default value is QwtPicker::NoRubberBand. | | The default value is QwtPicker::NoRubberBand. | |
| \sa setRubberBand(), rubberBand() | | \sa setRubberBand(), rubberBand() | |
| */ | | */ | |
| | | | |
| enum RubberBand | | enum RubberBand | |
| { | | { | |
| //! No rubberband. | | //! No rubberband. | |
| NoRubberBand = 0, | | NoRubberBand = 0, | |
| | | | |
|
| //! A horizontal line ( only for QwtPicker::PointSelection ) | | //! A horizontal line ( only for QwtPickerMachine::PointSelection ) | |
| HLineRubberBand, | | HLineRubberBand, | |
| | | | |
|
| //! A vertical line ( only for QwtPicker::PointSelection ) | | //! A vertical line ( only for QwtPickerMachine::PointSelection ) | |
| VLineRubberBand, | | VLineRubberBand, | |
| | | | |
|
| //! A crosshair ( only for QwtPicker::PointSelection ) | | //! A crosshair ( only for QwtPickerMachine::PointSelection ) | |
| CrossRubberBand, | | CrossRubberBand, | |
| | | | |
|
| //! A rectangle ( only for QwtPicker::RectSelection ) | | //! A rectangle ( only for QwtPickerMachine::RectSelection ) | |
| RectRubberBand, | | RectRubberBand, | |
| | | | |
|
| //! An ellipse ( only for QwtPicker::RectSelection ) | | //! An ellipse ( only for QwtPickerMachine::RectSelection ) | |
| EllipseRubberBand, | | EllipseRubberBand, | |
| | | | |
|
| //! A polygon ( only for QwtPicker::&PolygonSelection ) | | //! A polygon ( only for QwtPickerMachine::PolygonSelection ) | |
| PolygonRubberBand, | | PolygonRubberBand, | |
| | | | |
| /*! | | /*! | |
| Values >= UserRubberBand can be used to define additional | | Values >= UserRubberBand can be used to define additional | |
| rubber bands. | | rubber bands. | |
| */ | | */ | |
| UserRubberBand = 100 | | UserRubberBand = 100 | |
| }; | | }; | |
| | | | |
| /*! | | /*! | |
| | | | |
| skipping to change at line 218 | | skipping to change at line 218 | |
| QFont trackerFont() const; | | QFont trackerFont() const; | |
| | | | |
| bool isEnabled() const; | | bool isEnabled() const; | |
| bool isActive() const; | | bool isActive() const; | |
| | | | |
| virtual bool eventFilter( QObject *, QEvent * ); | | virtual bool eventFilter( QObject *, QEvent * ); | |
| | | | |
| QWidget *parentWidget(); | | QWidget *parentWidget(); | |
| const QWidget *parentWidget() const; | | const QWidget *parentWidget() const; | |
| | | | |
|
| virtual QRect pickRect() const; | | virtual QPainterPath pickArea() const; | |
| | | | |
| virtual void drawRubberBand( QPainter * ) const; | | virtual void drawRubberBand( QPainter * ) const; | |
| virtual void drawTracker( QPainter * ) const; | | virtual void drawTracker( QPainter * ) const; | |
| | | | |
|
| | | virtual QRegion rubberBandMask() const; | |
| | | | |
| virtual QwtText trackerText( const QPoint &pos ) const; | | virtual QwtText trackerText( const QPoint &pos ) const; | |
| QPoint trackerPosition() const; | | QPoint trackerPosition() const; | |
| virtual QRect trackerRect( const QFont & ) const; | | virtual QRect trackerRect( const QFont & ) const; | |
| | | | |
| QPolygon selection() const; | | QPolygon selection() const; | |
| | | | |
| public Q_SLOTS: | | public Q_SLOTS: | |
| void setEnabled( bool ); | | void setEnabled( bool ); | |
| | | | |
| Q_SIGNALS: | | Q_SIGNALS: | |
| | | | |
| skipping to change at line 271 | | skipping to change at line 273 | |
| | | | |
| \param pos Position of the moved last point of the selection. | | \param pos Position of the moved last point of the selection. | |
| \sa move(), appended() | | \sa move(), appended() | |
| */ | | */ | |
| void moved( const QPoint &pos ); | | void moved( const QPoint &pos ); | |
| | | | |
| /*! | | /*! | |
| A signal emitted whenever the last appended point of the | | A signal emitted whenever the last appended point of the | |
| selection has been removed. | | selection has been removed. | |
| | | | |
|
| | | \param pos Position of the point, that has been removed | |
| \sa remove(), appended() | | \sa remove(), appended() | |
| */ | | */ | |
| void removed( const QPoint &pos ); | | void removed( const QPoint &pos ); | |
| /*! | | /*! | |
| A signal emitted when the active selection has been changed. | | A signal emitted when the active selection has been changed. | |
| This might happen when the observed widget is resized. | | This might happen when the observed widget is resized. | |
| | | | |
| \param selection Changed selection | | \param selection Changed selection | |
| \sa stretchSelection() | | \sa stretchSelection() | |
| */ | | */ | |
| | | | |
| skipping to change at line 312 | | skipping to change at line 315 | |
| virtual void widgetKeyPressEvent( QKeyEvent * ); | | virtual void widgetKeyPressEvent( QKeyEvent * ); | |
| virtual void widgetKeyReleaseEvent( QKeyEvent * ); | | virtual void widgetKeyReleaseEvent( QKeyEvent * ); | |
| virtual void widgetEnterEvent( QEvent * ); | | virtual void widgetEnterEvent( QEvent * ); | |
| virtual void widgetLeaveEvent( QEvent * ); | | virtual void widgetLeaveEvent( QEvent * ); | |
| | | | |
| virtual void stretchSelection( const QSize &oldSize, | | virtual void stretchSelection( const QSize &oldSize, | |
| const QSize &newSize ); | | const QSize &newSize ); | |
| | | | |
| virtual void updateDisplay(); | | virtual void updateDisplay(); | |
| | | | |
|
| const QWidget *rubberBandWidget() const; | | const QwtWidgetOverlay *rubberBandOverlay() const; | |
| const QWidget *trackerWidget() const; | | const QwtWidgetOverlay *trackerOverlay() const; | |
| | | | |
| const QPolygon &pickedPoints() const; | | const QPolygon &pickedPoints() const; | |
| | | | |
| private: | | private: | |
| void init( QWidget *, RubberBand rubberBand, DisplayMode trackerMode ); | | void init( QWidget *, RubberBand rubberBand, DisplayMode trackerMode ); | |
| | | | |
| void setMouseTracking( bool ); | | void setMouseTracking( bool ); | |
| | | | |
|
| class PickerWidget; | | | |
| class PrivateData; | | class PrivateData; | |
| PrivateData *d_data; | | PrivateData *d_data; | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 18 change blocks. |
| 18 lines changed or deleted | | 20 lines changed or added | |
|
| qwt_plot.h | | qwt_plot.h | |
| | | | |
| skipping to change at line 19 | | skipping to change at line 19 | |
| | | | |
| #ifndef QWT_PLOT_H | | #ifndef QWT_PLOT_H | |
| #define QWT_PLOT_H | | #define QWT_PLOT_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include "qwt_text.h" | | #include "qwt_text.h" | |
| #include "qwt_plot_dict.h" | | #include "qwt_plot_dict.h" | |
| #include "qwt_scale_map.h" | | #include "qwt_scale_map.h" | |
| #include "qwt_interval.h" | | #include "qwt_interval.h" | |
| #include <qframe.h> | | #include <qframe.h> | |
|
| | | #include <qlist.h> | |
| | | #include <qvariant.h> | |
| | | | |
| class QwtPlotLayout; | | class QwtPlotLayout; | |
|
| class QwtLegend; | | class QwtAbstractLegend; | |
| class QwtScaleWidget; | | class QwtScaleWidget; | |
| class QwtScaleEngine; | | class QwtScaleEngine; | |
| class QwtScaleDiv; | | class QwtScaleDiv; | |
| class QwtScaleDraw; | | class QwtScaleDraw; | |
| class QwtTextLabel; | | class QwtTextLabel; | |
|
| class QwtPlotCanvas; | | | |
| | | | |
| /*! | | /*! | |
| \brief A 2-D plotting widget | | \brief A 2-D plotting widget | |
| | | | |
| QwtPlot is a widget for plotting two-dimensional graphs. | | QwtPlot is a widget for plotting two-dimensional graphs. | |
| An unlimited number of plot items can be displayed on | | An unlimited number of plot items can be displayed on | |
| its canvas. Plot items might be curves (QwtPlotCurve), markers | | its canvas. Plot items might be curves (QwtPlotCurve), markers | |
| (QwtPlotMarker), the grid (QwtPlotGrid), or anything else derived | | (QwtPlotMarker), the grid (QwtPlotGrid), or anything else derived | |
| from QwtPlotItem. | | from QwtPlotItem. | |
| A plot can have up to four axes, with each plot item attached to an x- an
d | | A plot can have up to four axes, with each plot item attached to an x- an
d | |
|
| a y axis. The scales at the axes can be explicitely set (QwtScaleDiv), or | | a y axis. The scales at the axes can be explicitly set (QwtScaleDiv), or | |
| are calculated from the plot items, using algorithms (QwtScaleEngine) whi
ch | | are calculated from the plot items, using algorithms (QwtScaleEngine) whi
ch | |
| can be configured separately for each axis. | | can be configured separately for each axis. | |
| | | | |
|
| | | The simpleplot example is a good starting point to see how to set up a | |
| | | plot widget. | |
| | | | |
| \image html plot.png | | \image html plot.png | |
| | | | |
| \par Example | | \par Example | |
| The following example shows (schematically) the most simple | | The following example shows (schematically) the most simple | |
| way to use QwtPlot. By default, only the left and bottom axes are | | way to use QwtPlot. By default, only the left and bottom axes are | |
| visible and their scales are computed automatically. | | visible and their scales are computed automatically. | |
| \verbatim | | \verbatim | |
| #include <qwt_plot.h> | | #include <qwt_plot.h> | |
| #include <qwt_plot_curve.h> | | #include <qwt_plot_curve.h> | |
| | | | |
| | | | |
| skipping to change at line 73 | | skipping to change at line 77 | |
| curve2->attach(myPlot); | | curve2->attach(myPlot); | |
| | | | |
| // finally, refresh the plot | | // finally, refresh the plot | |
| myPlot->replot(); | | myPlot->replot(); | |
| \endverbatim | | \endverbatim | |
| */ | | */ | |
| | | | |
| class QWT_EXPORT QwtPlot: public QFrame, public QwtPlotDict | | class QWT_EXPORT QwtPlot: public QFrame, public QwtPlotDict | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
|
| | | | |
| | | Q_PROPERTY( QBrush canvasBackground | |
| | | READ canvasBackground WRITE setCanvasBackground ) | |
| | | Q_PROPERTY( bool autoReplot READ autoReplot WRITE setAutoReplot ) | |
| | | | |
| | | #if 0 | |
| | | // This property is intended to configure the plot | |
| | | // widget from a special dialog in the deigner plugin. | |
| | | // Disabled until such a dialog has been implemented. | |
| | | | |
| Q_PROPERTY( QString propertiesDocument | | Q_PROPERTY( QString propertiesDocument | |
| READ grabProperties WRITE applyProperties ) | | READ grabProperties WRITE applyProperties ) | |
|
| | | #endif | |
| | | | |
| public: | | public: | |
| //! \brief Axis index | | //! \brief Axis index | |
| enum Axis | | enum Axis | |
| { | | { | |
| //! Y axis left of the canvas | | //! Y axis left of the canvas | |
| yLeft, | | yLeft, | |
| | | | |
| //! Y axis right of the canvas | | //! Y axis right of the canvas | |
| yRight, | | yRight, | |
| | | | |
| skipping to change at line 100 | | skipping to change at line 115 | |
| xTop, | | xTop, | |
| | | | |
| //! Number of axes | | //! Number of axes | |
| axisCnt | | axisCnt | |
| }; | | }; | |
| | | | |
| /*! | | /*! | |
| Position of the legend, relative to the canvas. | | Position of the legend, relative to the canvas. | |
| | | | |
| \sa insertLegend() | | \sa insertLegend() | |
|
| \note In case of ExternalLegend, the legend is not | | | |
| handled by QwtPlotRenderer | | | |
| */ | | */ | |
| enum LegendPosition | | enum LegendPosition | |
| { | | { | |
| //! The legend will be left from the QwtPlot::yLeft axis. | | //! The legend will be left from the QwtPlot::yLeft axis. | |
| LeftLegend, | | LeftLegend, | |
| | | | |
| //! The legend will be right from the QwtPlot::yRight axis. | | //! The legend will be right from the QwtPlot::yRight axis. | |
| RightLegend, | | RightLegend, | |
| | | | |
|
| //! The legend will be below QwtPlot::xBottom axis. | | //! The legend will be below the footer | |
| BottomLegend, | | BottomLegend, | |
| | | | |
|
| //! The legend will be between QwtPlot::xTop axis and the title. | | //! The legend will be above the title | |
| TopLegend, | | TopLegend | |
| | | | |
| /*! | | | |
| External means that only the content of the legend | | | |
| will be handled by QwtPlot, but not its geometry. | | | |
| This type can be used to have a legend in an | | | |
| external window ( or on the canvas ). | | | |
| */ | | | |
| ExternalLegend | | | |
| }; | | }; | |
| | | | |
| explicit QwtPlot( QWidget * = NULL ); | | explicit QwtPlot( QWidget * = NULL ); | |
|
| explicit QwtPlot( const QwtText &title, QWidget *p = NULL ); | | explicit QwtPlot( const QwtText &title, QWidget * = NULL ); | |
| | | | |
| virtual ~QwtPlot(); | | virtual ~QwtPlot(); | |
| | | | |
| void applyProperties( const QString & ); | | void applyProperties( const QString & ); | |
| QString grabProperties() const; | | QString grabProperties() const; | |
| | | | |
|
| void setAutoReplot( bool tf = true ); | | void setAutoReplot( bool = true ); | |
| bool autoReplot() const; | | bool autoReplot() const; | |
| | | | |
| // Layout | | // Layout | |
| | | | |
|
| | | void setPlotLayout( QwtPlotLayout * ); | |
| | | | |
| QwtPlotLayout *plotLayout(); | | QwtPlotLayout *plotLayout(); | |
| const QwtPlotLayout *plotLayout() const; | | const QwtPlotLayout *plotLayout() const; | |
| | | | |
| // Title | | // Title | |
| | | | |
| void setTitle( const QString & ); | | void setTitle( const QString & ); | |
| void setTitle( const QwtText &t ); | | void setTitle( const QwtText &t ); | |
| QwtText title() const; | | QwtText title() const; | |
| | | | |
| QwtTextLabel *titleLabel(); | | QwtTextLabel *titleLabel(); | |
| const QwtTextLabel *titleLabel() const; | | const QwtTextLabel *titleLabel() const; | |
| | | | |
|
| | | // Footer | |
| | | | |
| | | void setFooter( const QString & ); | |
| | | void setFooter( const QwtText &t ); | |
| | | QwtText footer() const; | |
| | | | |
| | | QwtTextLabel *footerLabel(); | |
| | | const QwtTextLabel *footerLabel() const; | |
| | | | |
| // Canvas | | // Canvas | |
| | | | |
|
| QwtPlotCanvas *canvas(); | | void setCanvas( QWidget * ); | |
| const QwtPlotCanvas *canvas() const; | | | |
| | | QWidget *canvas(); | |
| | | const QWidget *canvas() const; | |
| | | | |
| void setCanvasBackground( const QBrush & ); | | void setCanvasBackground( const QBrush & ); | |
| QBrush canvasBackground() const; | | QBrush canvasBackground() const; | |
| | | | |
|
| void setCanvasLineWidth( int w ); | | | |
| int canvasLineWidth() const; | | | |
| | | | |
| virtual QwtScaleMap canvasMap( int axisId ) const; | | virtual QwtScaleMap canvasMap( int axisId ) const; | |
| | | | |
| double invTransform( int axisId, int pos ) const; | | double invTransform( int axisId, int pos ) const; | |
| double transform( int axisId, double value ) const; | | double transform( int axisId, double value ) const; | |
| | | | |
| // Axes | | // Axes | |
| | | | |
| QwtScaleEngine *axisScaleEngine( int axisId ); | | QwtScaleEngine *axisScaleEngine( int axisId ); | |
| const QwtScaleEngine *axisScaleEngine( int axisId ) const; | | const QwtScaleEngine *axisScaleEngine( int axisId ) const; | |
| void setAxisScaleEngine( int axisId, QwtScaleEngine * ); | | void setAxisScaleEngine( int axisId, QwtScaleEngine * ); | |
| | | | |
| skipping to change at line 189 | | skipping to change at line 204 | |
| void setAxisFont( int axisId, const QFont &f ); | | void setAxisFont( int axisId, const QFont &f ); | |
| QFont axisFont( int axisId ) const; | | QFont axisFont( int axisId ) const; | |
| | | | |
| void setAxisScale( int axisId, double min, double max, double step = 0
); | | void setAxisScale( int axisId, double min, double max, double step = 0
); | |
| void setAxisScaleDiv( int axisId, const QwtScaleDiv & ); | | void setAxisScaleDiv( int axisId, const QwtScaleDiv & ); | |
| void setAxisScaleDraw( int axisId, QwtScaleDraw * ); | | void setAxisScaleDraw( int axisId, QwtScaleDraw * ); | |
| | | | |
| double axisStepSize( int axisId ) const; | | double axisStepSize( int axisId ) const; | |
| QwtInterval axisInterval( int axisId ) const; | | QwtInterval axisInterval( int axisId ) const; | |
| | | | |
|
| const QwtScaleDiv *axisScaleDiv( int axisId ) const; | | const QwtScaleDiv &axisScaleDiv( int axisId ) const; | |
| QwtScaleDiv *axisScaleDiv( int axisId ); | | | |
| | | | |
| const QwtScaleDraw *axisScaleDraw( int axisId ) const; | | const QwtScaleDraw *axisScaleDraw( int axisId ) const; | |
| QwtScaleDraw *axisScaleDraw( int axisId ); | | QwtScaleDraw *axisScaleDraw( int axisId ); | |
| | | | |
| const QwtScaleWidget *axisWidget( int axisId ) const; | | const QwtScaleWidget *axisWidget( int axisId ) const; | |
| QwtScaleWidget *axisWidget( int axisId ); | | QwtScaleWidget *axisWidget( int axisId ); | |
| | | | |
| void setAxisLabelAlignment( int axisId, Qt::Alignment ); | | void setAxisLabelAlignment( int axisId, Qt::Alignment ); | |
| void setAxisLabelRotation( int axisId, double rotation ); | | void setAxisLabelRotation( int axisId, double rotation ); | |
| | | | |
| | | | |
| skipping to change at line 213 | | skipping to change at line 227 | |
| QwtText axisTitle( int axisId ) const; | | QwtText axisTitle( int axisId ) const; | |
| | | | |
| void setAxisMaxMinor( int axisId, int maxMinor ); | | void setAxisMaxMinor( int axisId, int maxMinor ); | |
| int axisMaxMinor( int axisId ) const; | | int axisMaxMinor( int axisId ) const; | |
| | | | |
| void setAxisMaxMajor( int axisId, int maxMajor ); | | void setAxisMaxMajor( int axisId, int maxMajor ); | |
| int axisMaxMajor( int axisId ) const; | | int axisMaxMajor( int axisId ) const; | |
| | | | |
| // Legend | | // Legend | |
| | | | |
|
| void insertLegend( QwtLegend *, LegendPosition = QwtPlot::RightLegend, | | void insertLegend( QwtAbstractLegend *, | |
| double ratio = -1.0 ); | | LegendPosition = QwtPlot::RightLegend, double ratio = -1.0 ); | |
| | | | |
|
| QwtLegend *legend(); | | QwtAbstractLegend *legend(); | |
| const QwtLegend *legend() const; | | const QwtAbstractLegend *legend() const; | |
| | | | |
| | | void updateLegend(); | |
| | | void updateLegend( const QwtPlotItem * ); | |
| | | | |
| // Misc | | // Misc | |
| | | | |
| virtual QSize sizeHint() const; | | virtual QSize sizeHint() const; | |
| virtual QSize minimumSizeHint() const; | | virtual QSize minimumSizeHint() const; | |
| | | | |
| virtual void updateLayout(); | | virtual void updateLayout(); | |
| virtual void drawCanvas( QPainter * ); | | virtual void drawCanvas( QPainter * ); | |
| | | | |
| void updateAxes(); | | void updateAxes(); | |
|
| | | void updateCanvasMargins(); | |
| | | | |
| | | virtual void getCanvasMarginsHint( | |
| | | const QwtScaleMap maps[], const QRectF &canvasRect, | |
| | | double &left, double &top, double &right, double &bottom) const; | |
| | | | |
| virtual bool event( QEvent * ); | | virtual bool event( QEvent * ); | |
|
| | | virtual bool eventFilter( QObject *, QEvent * ); | |
| | | | |
| virtual void drawItems( QPainter *, const QRectF &, | | virtual void drawItems( QPainter *, const QRectF &, | |
| const QwtScaleMap maps[axisCnt] ) const; | | const QwtScaleMap maps[axisCnt] ) const; | |
| | | | |
|
| | | virtual QVariant itemToInfo( QwtPlotItem * ) const; | |
| | | virtual QwtPlotItem *infoToItem( const QVariant & ) const; | |
| | | | |
| Q_SIGNALS: | | Q_SIGNALS: | |
| /*! | | /*! | |
|
| A signal which is emitted when the user has clicked on | | A signal indicating, that an item has been attached/detached | |
| a legend item, which is in QwtLegend::ClickableItem mode. | | | |
| | | | |
|
| \param plotItem Corresponding plot item of the | | \param plotItem Plot item | |
| selected legend item | | \param on Attached/Detached | |
| | | | |
| \note clicks are disabled as default | | | |
| \sa QwtLegend::setItemMode(), QwtLegend::itemMode() | | | |
| */ | | */ | |
|
| void legendClicked( QwtPlotItem *plotItem ); | | void itemAttached( QwtPlotItem *plotItem, bool on ); | |
| | | | |
| /*! | | /*! | |
|
| A signal which is emitted when the user has clicked on | | A signal with the attributes how to update | |
| a legend item, which is in QwtLegend::CheckableItem mode | | the legend entries for a plot item. | |
| | | | |
|
| \param plotItem Corresponding plot item of the | | \param itemInfo Info about a plot item, build from itemToInfo() | |
| selected legend item | | \param data Attributes of the entries ( usually <= 1 ) for | |
| \param on True when the legen item is checked | | the plot item. | |
| | | | |
|
| \note clicks are disabled as default | | \sa itemToInfo(), infoToItem(), QwtAbstractLegend::updateLegend() | |
| \sa QwtLegend::setItemMode(), QwtLegend::itemMode() | | | |
| */ | | */ | |
|
| | | void legendDataChanged( const QVariant &itemInfo, | |
| void legendChecked( QwtPlotItem *plotItem, bool on ); | | const QList<QwtLegendData> &data ); | |
| | | | |
| public Q_SLOTS: | | public Q_SLOTS: | |
| virtual void replot(); | | virtual void replot(); | |
| void autoRefresh(); | | void autoRefresh(); | |
| | | | |
|
| protected Q_SLOTS: | | | |
| virtual void legendItemClicked(); | | | |
| virtual void legendItemChecked( bool ); | | | |
| | | | |
| protected: | | protected: | |
| static bool axisValid( int axisId ); | | static bool axisValid( int axisId ); | |
| | | | |
|
| virtual void updateTabOrder(); | | | |
| | | | |
| virtual void resizeEvent( QResizeEvent *e ); | | virtual void resizeEvent( QResizeEvent *e ); | |
| | | | |
|
| | | private Q_SLOTS: | |
| | | void updateLegendItems( const QVariant &itemInfo, | |
| | | const QList<QwtLegendData> &data ); | |
| | | | |
| private: | | private: | |
|
| | | friend class QwtPlotItem; | |
| | | void attachItem( QwtPlotItem *, bool ); | |
| | | | |
| void initAxesData(); | | void initAxesData(); | |
| void deleteAxesData(); | | void deleteAxesData(); | |
| void updateScaleDiv(); | | void updateScaleDiv(); | |
| | | | |
| void initPlot( const QwtText &title ); | | void initPlot( const QwtText &title ); | |
| | | | |
| class AxisData; | | class AxisData; | |
| AxisData *d_axisData[axisCnt]; | | AxisData *d_axisData[axisCnt]; | |
| | | | |
| class PrivateData; | | class PrivateData; | |
| | | | |
End of changes. 33 change blocks. |
| 52 lines changed or deleted | | 74 lines changed or added | |
|
| qwt_plot_canvas.h | | qwt_plot_canvas.h | |
| | | | |
| skipping to change at line 15 | | skipping to change at line 15 | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_PLOT_CANVAS_H | | #ifndef QWT_PLOT_CANVAS_H | |
| #define QWT_PLOT_CANVAS_H | | #define QWT_PLOT_CANVAS_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include <qframe.h> | | #include <qframe.h> | |
|
| #include <qpen.h> | | | |
| #include <qpainterpath.h> | | #include <qpainterpath.h> | |
|
| #include <qbitmap.h> | | | |
| | | | |
| class QwtPlot; | | class QwtPlot; | |
| class QPixmap; | | class QPixmap; | |
| | | | |
| /*! | | /*! | |
| \brief Canvas of a QwtPlot. | | \brief Canvas of a QwtPlot. | |
| | | | |
| Canvas is the widget where all plot items are displayed | | Canvas is the widget where all plot items are displayed | |
| | | | |
|
| \sa QwtPlot | | \sa QwtPlot::setCanvas(), QwtPlotGLCanvas | |
| */ | | */ | |
| class QWT_EXPORT QwtPlotCanvas : public QFrame | | class QWT_EXPORT QwtPlotCanvas : public QFrame | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| | | | |
|
| | | Q_PROPERTY( double borderRadius READ borderRadius WRITE setBorderRadius | |
| | | ) | |
| | | | |
| public: | | public: | |
| | | | |
| /*! | | /*! | |
| \brief Paint attributes | | \brief Paint attributes | |
| | | | |
| The default setting enables BackingStore and Opaque. | | The default setting enables BackingStore and Opaque. | |
| | | | |
| \sa setPaintAttribute(), testPaintAttribute() | | \sa setPaintAttribute(), testPaintAttribute() | |
| */ | | */ | |
| enum PaintAttribute | | enum PaintAttribute | |
| { | | { | |
| /*! | | /*! | |
| \brief Paint double buffered reusing the content | | \brief Paint double buffered reusing the content | |
| of the pixmap buffer when possible. | | of the pixmap buffer when possible. | |
| | | | |
| Using a backing store might improve the performance | | Using a backing store might improve the performance | |
|
| significantly, when workin with widget overlays ( like rubberband
s ). | | significantly, when working with widget overlays ( like rubber ba
nds ). | |
| Disabling the cache might improve the performance for | | Disabling the cache might improve the performance for | |
| incremental paints (using QwtPlotDirectPainter ). | | incremental paints (using QwtPlotDirectPainter ). | |
| | | | |
| \sa backingStore(), invalidateBackingStore() | | \sa backingStore(), invalidateBackingStore() | |
| */ | | */ | |
| BackingStore = 1, | | BackingStore = 1, | |
| | | | |
| /*! | | /*! | |
| \brief Try to fill the complete contents rectangle | | \brief Try to fill the complete contents rectangle | |
| of the plot canvas | | of the plot canvas | |
| | | | |
| skipping to change at line 83 | | skipping to change at line 83 | |
| | | | |
| /*! | | /*! | |
| \brief Try to improve painting of styled backgrounds | | \brief Try to improve painting of styled backgrounds | |
| | | | |
| QwtPlotCanvas supports the box model attributes for | | QwtPlotCanvas supports the box model attributes for | |
| customizing the layout with style sheets. Unfortunately | | customizing the layout with style sheets. Unfortunately | |
| the design of Qt style sheets has no concept how to | | the design of Qt style sheets has no concept how to | |
| handle backgrounds with rounded corners - beside of padding. | | handle backgrounds with rounded corners - beside of padding. | |
| | | | |
| When HackStyledBackground is enabled the plot canvas tries | | When HackStyledBackground is enabled the plot canvas tries | |
|
| to seperate the background from the background border | | to separate the background from the background border | |
| by reverse engeneering to paint the background before and | | by reverse engineering to paint the background before and | |
| the border after the plot items. In this order the border | | the border after the plot items. In this order the border | |
|
| gets prefectly antialiased and you can avoid some pixel | | gets perfectly antialiased and you can avoid some pixel | |
| artifacts in the corners. | | artifacts in the corners. | |
| */ | | */ | |
| HackStyledBackground = 4, | | HackStyledBackground = 4, | |
| | | | |
| /*! | | /*! | |
| When ImmediatePaint is set replot() calls repaint() | | When ImmediatePaint is set replot() calls repaint() | |
| instead of update(). | | instead of update(). | |
| | | | |
| \sa replot(), QWidget::repaint(), QWidget::update() | | \sa replot(), QWidget::repaint(), QWidget::update() | |
| */ | | */ | |
| | | | |
| skipping to change at line 128 | | skipping to change at line 128 | |
| CanvasFocusIndicator, | | CanvasFocusIndicator, | |
| | | | |
| /*! | | /*! | |
| The focus is related to an item (curve, point, ...) on | | The focus is related to an item (curve, point, ...) on | |
| the canvas. It is up to the application to display a | | the canvas. It is up to the application to display a | |
| focus indication using f.e. highlighting. | | focus indication using f.e. highlighting. | |
| */ | | */ | |
| ItemFocusIndicator | | ItemFocusIndicator | |
| }; | | }; | |
| | | | |
|
| explicit QwtPlotCanvas( QwtPlot * ); | | explicit QwtPlotCanvas( QwtPlot * = NULL ); | |
| virtual ~QwtPlotCanvas(); | | virtual ~QwtPlotCanvas(); | |
| | | | |
| QwtPlot *plot(); | | QwtPlot *plot(); | |
| const QwtPlot *plot() const; | | const QwtPlot *plot() const; | |
| | | | |
| void setFocusIndicator( FocusIndicator ); | | void setFocusIndicator( FocusIndicator ); | |
| FocusIndicator focusIndicator() const; | | FocusIndicator focusIndicator() const; | |
| | | | |
| void setBorderRadius( double ); | | void setBorderRadius( double ); | |
| double borderRadius() const; | | double borderRadius() const; | |
| | | | |
|
| QPainterPath borderPath( const QRect &rect ) const; | | | |
| QBitmap borderMask( const QSize & ) const; | | | |
| | | | |
| void setPaintAttribute( PaintAttribute, bool on = true ); | | void setPaintAttribute( PaintAttribute, bool on = true ); | |
| bool testPaintAttribute( PaintAttribute ) const; | | bool testPaintAttribute( PaintAttribute ) const; | |
| | | | |
| const QPixmap *backingStore() const; | | const QPixmap *backingStore() const; | |
| void invalidateBackingStore(); | | void invalidateBackingStore(); | |
| | | | |
|
| void replot(); | | | |
| | | | |
| virtual bool event( QEvent * ); | | virtual bool event( QEvent * ); | |
| | | | |
|
| | | Q_INVOKABLE QPainterPath borderPath( const QRect & ) const; | |
| | | | |
| | | public Q_SLOTS: | |
| | | void replot(); | |
| | | | |
| protected: | | protected: | |
| virtual void paintEvent( QPaintEvent * ); | | virtual void paintEvent( QPaintEvent * ); | |
| virtual void resizeEvent( QResizeEvent * ); | | virtual void resizeEvent( QResizeEvent * ); | |
| | | | |
| virtual void drawFocusIndicator( QPainter * ); | | virtual void drawFocusIndicator( QPainter * ); | |
| virtual void drawBorder( QPainter * ); | | virtual void drawBorder( QPainter * ); | |
| | | | |
| void updateStyleSheetInfo(); | | void updateStyleSheetInfo(); | |
| | | | |
| private: | | private: | |
| | | | |
End of changes. 11 change blocks. |
| 13 lines changed or deleted | | 14 lines changed or added | |
|
| qwt_plot_curve.h | | qwt_plot_curve.h | |
| | | | |
| skipping to change at line 55 | | skipping to change at line 55 | |
| arrays internally.</dd> | | arrays internally.</dd> | |
| <dt>c) Attach the curve to a plot</dt> | | <dt>c) Attach the curve to a plot</dt> | |
| <dd>See QwtPlotItem::attach() | | <dd>See QwtPlotItem::attach() | |
| </dd></dl> | | </dd></dl> | |
| | | | |
| \par Example: | | \par Example: | |
| see examples/bode | | see examples/bode | |
| | | | |
| \sa QwtPointSeriesData, QwtSymbol, QwtScaleMap | | \sa QwtPointSeriesData, QwtSymbol, QwtScaleMap | |
| */ | | */ | |
|
| class QWT_EXPORT QwtPlotCurve: public QwtPlotSeriesItem<QPointF> | | class QWT_EXPORT QwtPlotCurve: | |
| | | public QwtPlotSeriesItem, public QwtSeriesStore<QPointF> | |
| { | | { | |
| public: | | public: | |
| /*! | | /*! | |
| Curve styles. | | Curve styles. | |
| \sa setStyle(), style() | | \sa setStyle(), style() | |
| */ | | */ | |
| enum CurveStyle | | enum CurveStyle | |
| { | | { | |
| /*! | | /*! | |
| Don't draw a curve. Note: This doesn't affect the symbols. | | Don't draw a curve. Note: This doesn't affect the symbols. | |
| | | | |
| skipping to change at line 122 | | skipping to change at line 123 | |
| For QwtPlotCurve::Steps only. | | For QwtPlotCurve::Steps only. | |
| Draws a step function from the right to the left. | | Draws a step function from the right to the left. | |
| */ | | */ | |
| Inverted = 0x01, | | Inverted = 0x01, | |
| | | | |
| /*! | | /*! | |
| Only in combination with QwtPlotCurve::Lines | | Only in combination with QwtPlotCurve::Lines | |
| A QwtCurveFitter tries to | | A QwtCurveFitter tries to | |
| interpolate/smooth the curve, before it is painted. | | interpolate/smooth the curve, before it is painted. | |
| | | | |
|
| \note Curve fitting requires temorary memory | | \note Curve fitting requires temporary memory | |
| for calculating coefficients and additional points. | | for calculating coefficients and additional points. | |
| If painting in QwtPlotCurve::Fitted mode is slow it might be bett
er | | If painting in QwtPlotCurve::Fitted mode is slow it might be bett
er | |
| to fit the points, before they are passed to QwtPlotCurve. | | to fit the points, before they are passed to QwtPlotCurve. | |
| */ | | */ | |
| Fitted = 0x02 | | Fitted = 0x02 | |
| }; | | }; | |
| | | | |
| //! Curve attributes | | //! Curve attributes | |
| typedef QFlags<CurveAttribute> CurveAttributes; | | typedef QFlags<CurveAttribute> CurveAttributes; | |
| | | | |
| /*! | | /*! | |
| Attributes how to represent the curve on the legend | | Attributes how to represent the curve on the legend | |
| | | | |
| \sa setLegendAttribute(), testLegendAttribute(), | | \sa setLegendAttribute(), testLegendAttribute(), | |
|
| drawLegendIdentifier() | | QwtPlotItem::legendData(), legendIcon() | |
| */ | | */ | |
| | | | |
| enum LegendAttribute | | enum LegendAttribute | |
| { | | { | |
| /*! | | /*! | |
| QwtPlotCurve tries to find a color representing the curve | | QwtPlotCurve tries to find a color representing the curve | |
| and paints a rectangle with it. | | and paints a rectangle with it. | |
| */ | | */ | |
| LegendNoAttribute = 0x00, | | LegendNoAttribute = 0x00, | |
| | | | |
| | | | |
| skipping to change at line 171 | | skipping to change at line 172 | |
| curve brush() is painted. | | curve brush() is painted. | |
| */ | | */ | |
| LegendShowBrush = 0x04 | | LegendShowBrush = 0x04 | |
| }; | | }; | |
| | | | |
| //! Legend attributes | | //! Legend attributes | |
| typedef QFlags<LegendAttribute> LegendAttributes; | | typedef QFlags<LegendAttribute> LegendAttributes; | |
| | | | |
| /*! | | /*! | |
| Attributes to modify the drawing algorithm. | | Attributes to modify the drawing algorithm. | |
|
| The default setting enables ClipPolygons | | The default setting enables ClipPolygons | FilterPoints | |
| | | | |
| \sa setPaintAttribute(), testPaintAttribute() | | \sa setPaintAttribute(), testPaintAttribute() | |
| */ | | */ | |
| enum PaintAttribute | | enum PaintAttribute | |
| { | | { | |
| /*! | | /*! | |
| Clip polygons before painting them. In situations, where points | | Clip polygons before painting them. In situations, where points | |
| are far outside the visible area (f.e when zooming deep) this | | are far outside the visible area (f.e when zooming deep) this | |
| might be a substantial improvement for the painting performance | | might be a substantial improvement for the painting performance | |
| */ | | */ | |
| ClipPolygons = 0x01, | | ClipPolygons = 0x01, | |
| | | | |
| /*! | | /*! | |
|
| Paint the symbol to a QPixmap and paint the pixmap | | Tries to reduce the data that has to be painted, by sorting out | |
| instead rendering the symbol for each point. The flag has | | duplicates, or paintings outside the visible area. Might have a | |
| no effect, when the curve is not painted to the canvas | | notable impact on curves with many close points. | |
| ( f.e when exporting the plot to a PDF document ). | | Only a couple of very basic filtering algorithms are implemented. | |
| */ | | */ | |
|
| CacheSymbols = 0x02 | | FilterPoints = 0x02, | |
| | | | |
| | | /*! | |
| | | Minimize memory usage that is temporarily needed for the | |
| | | translated points, before they get painted. | |
| | | This might slow down the performance of painting | |
| | | */ | |
| | | MinimizeMemory = 0x04, | |
| | | | |
| | | /*! | |
| | | Render the points to a temporary image and paint the image. | |
| | | This is a very special optimization for Dots style, when | |
| | | having a huge amount of points. | |
| | | With a reasonable number of points QPainter::drawPoints() | |
| | | will be faster. | |
| | | */ | |
| | | ImageBuffer = 0x08 | |
| }; | | }; | |
| | | | |
| //! Paint attributes | | //! Paint attributes | |
| typedef QFlags<PaintAttribute> PaintAttributes; | | typedef QFlags<PaintAttribute> PaintAttributes; | |
| | | | |
| explicit QwtPlotCurve( const QString &title = QString::null ); | | explicit QwtPlotCurve( const QString &title = QString::null ); | |
| explicit QwtPlotCurve( const QwtText &title ); | | explicit QwtPlotCurve( const QwtText &title ); | |
| | | | |
| virtual ~QwtPlotCurve(); | | virtual ~QwtPlotCurve(); | |
| | | | |
| | | | |
| skipping to change at line 215 | | skipping to change at line 232 | |
| | | | |
| void setLegendAttribute( LegendAttribute, bool on = true ); | | void setLegendAttribute( LegendAttribute, bool on = true ); | |
| bool testLegendAttribute( LegendAttribute ) const; | | bool testLegendAttribute( LegendAttribute ) const; | |
| | | | |
| #ifndef QWT_NO_COMPAT | | #ifndef QWT_NO_COMPAT | |
| void setRawSamples( const double *xData, const double *yData, int size
); | | void setRawSamples( const double *xData, const double *yData, int size
); | |
| void setSamples( const double *xData, const double *yData, int size ); | | void setSamples( const double *xData, const double *yData, int size ); | |
| void setSamples( const QVector<double> &xData, const QVector<double> &y
Data ); | | void setSamples( const QVector<double> &xData, const QVector<double> &y
Data ); | |
| #endif | | #endif | |
| void setSamples( const QVector<QPointF> & ); | | void setSamples( const QVector<QPointF> & ); | |
|
| | | void setSamples( QwtSeriesData<QPointF> * ); | |
| | | | |
| int closestPoint( const QPoint &pos, double *dist = NULL ) const; | | int closestPoint( const QPoint &pos, double *dist = NULL ) const; | |
| | | | |
| double minXValue() const; | | double minXValue() const; | |
| double maxXValue() const; | | double maxXValue() const; | |
| double minYValue() const; | | double minYValue() const; | |
| double maxYValue() const; | | double maxYValue() const; | |
| | | | |
| void setCurveAttribute( CurveAttribute, bool on = true ); | | void setCurveAttribute( CurveAttribute, bool on = true ); | |
| bool testCurveAttribute( CurveAttribute ) const; | | bool testCurveAttribute( CurveAttribute ) const; | |
| | | | |
|
| | | void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::Soli
dLine ); | |
| void setPen( const QPen & ); | | void setPen( const QPen & ); | |
| const QPen &pen() const; | | const QPen &pen() const; | |
| | | | |
| void setBrush( const QBrush & ); | | void setBrush( const QBrush & ); | |
| const QBrush &brush() const; | | const QBrush &brush() const; | |
| | | | |
|
| void setBaseline( double ref ); | | void setBaseline( double ); | |
| double baseline() const; | | double baseline() const; | |
| | | | |
| void setStyle( CurveStyle style ); | | void setStyle( CurveStyle style ); | |
| CurveStyle style() const; | | CurveStyle style() const; | |
| | | | |
|
| void setSymbol( const QwtSymbol *s ); | | void setSymbol( QwtSymbol * ); | |
| const QwtSymbol *symbol() const; | | const QwtSymbol *symbol() const; | |
| | | | |
| void setCurveFitter( QwtCurveFitter * ); | | void setCurveFitter( QwtCurveFitter * ); | |
| QwtCurveFitter *curveFitter() const; | | QwtCurveFitter *curveFitter() const; | |
| | | | |
| virtual void drawSeries( QPainter *, | | virtual void drawSeries( QPainter *, | |
| const QwtScaleMap &xMap, const QwtScaleMap &yMap, | | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |
| const QRectF &canvasRect, int from, int to ) const; | | const QRectF &canvasRect, int from, int to ) const; | |
| | | | |
|
| virtual void updateLegend( QwtLegend * ) const; | | virtual QwtGraphic legendIcon( int index, const QSizeF & ) const; | |
| virtual void drawLegendIdentifier( QPainter *, const QRectF & ) const; | | | |
| | | | |
| protected: | | protected: | |
| | | | |
| void init(); | | void init(); | |
| | | | |
|
| virtual void drawCurve( QPainter *, int style, | | virtual void drawCurve( QPainter *p, int style, | |
| const QwtScaleMap &xMap, const QwtScaleMap &yMap, | | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |
| const QRectF &canvasRect, int from, int to ) const; | | const QRectF &canvasRect, int from, int to ) const; | |
| | | | |
|
| virtual void drawSymbols( QPainter *, const QwtSymbol &, | | virtual void drawSymbols( QPainter *p, const QwtSymbol &, | |
| const QwtScaleMap &xMap, const QwtScaleMap &yMap, | | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |
| const QRectF &canvasRect, int from, int to ) const; | | const QRectF &canvasRect, int from, int to ) const; | |
| | | | |
|
| void drawLines( QPainter *, | | virtual void drawLines( QPainter *p, | |
| const QwtScaleMap &xMap, const QwtScaleMap &yMap, | | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |
| const QRectF &canvasRect, int from, int to ) const; | | const QRectF &canvasRect, int from, int to ) const; | |
| | | | |
|
| void drawSticks( QPainter *, | | virtual void drawSticks( QPainter *p, | |
| const QwtScaleMap &xMap, const QwtScaleMap &yMap, | | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |
| const QRectF &canvasRect, int from, int to ) const; | | const QRectF &canvasRect, int from, int to ) const; | |
| | | | |
|
| void drawDots( QPainter *, | | virtual void drawDots( QPainter *p, | |
| const QwtScaleMap &xMap, const QwtScaleMap &yMap, | | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |
| const QRectF &canvasRect, int from, int to ) const; | | const QRectF &canvasRect, int from, int to ) const; | |
| | | | |
|
| void drawSteps( QPainter *, | | virtual void drawSteps( QPainter *p, | |
| const QwtScaleMap &xMap, const QwtScaleMap &yMap, | | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |
| const QRectF &canvasRect, int from, int to ) const; | | const QRectF &canvasRect, int from, int to ) const; | |
| | | | |
| virtual void fillCurve( QPainter *, | | virtual void fillCurve( QPainter *, | |
| const QwtScaleMap &, const QwtScaleMap &, | | const QwtScaleMap &, const QwtScaleMap &, | |
| const QRectF &canvasRect, QPolygonF & ) const; | | const QRectF &canvasRect, QPolygonF & ) const; | |
| | | | |
| void closePolyline( QPainter *, | | void closePolyline( QPainter *, | |
| const QwtScaleMap &, const QwtScaleMap &, QPolygonF & ) const; | | const QwtScaleMap &, const QwtScaleMap &, QPolygonF & ) const; | |
| | | | |
| | | | |
End of changes. 17 change blocks. |
| 19 lines changed or deleted | | 37 lines changed or added | |
|
| qwt_plot_directpainter.h | | qwt_plot_directpainter.h | |
| | | | |
| skipping to change at line 17 | | skipping to change at line 17 | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_PLOT_DIRECT_PAINTER_H | | #ifndef QWT_PLOT_DIRECT_PAINTER_H | |
| #define QWT_PLOT_DIRECT_PAINTER_H | | #define QWT_PLOT_DIRECT_PAINTER_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include <qobject.h> | | #include <qobject.h> | |
| | | | |
| class QRegion; | | class QRegion; | |
|
| class QwtPlotAbstractSeriesItem; | | class QwtPlotSeriesItem; | |
| | | | |
| /*! | | /*! | |
| \brief Painter object trying to paint incrementally | | \brief Painter object trying to paint incrementally | |
| | | | |
| Often applications want to display samples while they are | | Often applications want to display samples while they are | |
| collected. When there are too many samples complete replots | | collected. When there are too many samples complete replots | |
| will be expensive to be processed in a collection cycle. | | will be expensive to be processed in a collection cycle. | |
| | | | |
| QwtPlotDirectPainter offers an API to paint | | QwtPlotDirectPainter offers an API to paint | |
| subsets ( f.e all additions points ) without erasing/repainting | | subsets ( f.e all additions points ) without erasing/repainting | |
| | | | |
| skipping to change at line 57 | | skipping to change at line 57 | |
| { | | { | |
| /*! | | /*! | |
| Initializing a QPainter is an expensive operation. | | Initializing a QPainter is an expensive operation. | |
| When AtomicPainter is set each call of drawSeries() opens/closes | | When AtomicPainter is set each call of drawSeries() opens/closes | |
| a temporary QPainter. Otherwise QwtPlotDirectPainter tries to | | a temporary QPainter. Otherwise QwtPlotDirectPainter tries to | |
| use the same QPainter as long as possible. | | use the same QPainter as long as possible. | |
| */ | | */ | |
| AtomicPainter = 0x01, | | AtomicPainter = 0x01, | |
| | | | |
| /*! | | /*! | |
|
| When FullRepaint is set the plot canvas is explicitely repainted | | When FullRepaint is set the plot canvas is explicitly repainted | |
| after the samples have been rendered. | | after the samples have been rendered. | |
| */ | | */ | |
| FullRepaint = 0x02, | | FullRepaint = 0x02, | |
| | | | |
| /*! | | /*! | |
| When QwtPlotCanvas::BackingStore is enabled the painter | | When QwtPlotCanvas::BackingStore is enabled the painter | |
| has to paint to the backing store and the widget. In certain | | has to paint to the backing store and the widget. In certain | |
| situations/environments it might be faster to paint to | | situations/environments it might be faster to paint to | |
|
| the backing store only and then copy the backingstore to the canv
as. | | the backing store only and then copy the backing store to the can
vas. | |
| This flag can also be useful for settings, where Qt fills the | | This flag can also be useful for settings, where Qt fills the | |
| the clip region with the widget background. | | the clip region with the widget background. | |
| */ | | */ | |
| CopyBackingStore = 0x04 | | CopyBackingStore = 0x04 | |
| }; | | }; | |
| | | | |
| //! Paint attributes | | //! Paint attributes | |
| typedef QFlags<Attribute> Attributes; | | typedef QFlags<Attribute> Attributes; | |
| | | | |
| QwtPlotDirectPainter( QObject *parent = NULL ); | | QwtPlotDirectPainter( QObject *parent = NULL ); | |
| | | | |
| skipping to change at line 88 | | skipping to change at line 88 | |
| | | | |
| void setAttribute( Attribute, bool on ); | | void setAttribute( Attribute, bool on ); | |
| bool testAttribute( Attribute ) const; | | bool testAttribute( Attribute ) const; | |
| | | | |
| void setClipping( bool ); | | void setClipping( bool ); | |
| bool hasClipping() const; | | bool hasClipping() const; | |
| | | | |
| void setClipRegion( const QRegion & ); | | void setClipRegion( const QRegion & ); | |
| QRegion clipRegion() const; | | QRegion clipRegion() const; | |
| | | | |
|
| void drawSeries( QwtPlotAbstractSeriesItem *, int from, int to ); | | void drawSeries( QwtPlotSeriesItem *, int from, int to ); | |
| void reset(); | | void reset(); | |
| | | | |
| virtual bool eventFilter( QObject *, QEvent * ); | | virtual bool eventFilter( QObject *, QEvent * ); | |
| | | | |
| private: | | private: | |
| class PrivateData; | | class PrivateData; | |
| PrivateData *d_data; | | PrivateData *d_data; | |
| }; | | }; | |
| | | | |
| Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotDirectPainter::Attributes ) | | Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotDirectPainter::Attributes ) | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 4 lines changed or added | |
|
| qwt_plot_grid.h | | qwt_plot_grid.h | |
| | | | |
| skipping to change at line 27 | | skipping to change at line 27 | |
| class QPainter; | | class QPainter; | |
| class QPen; | | class QPen; | |
| class QwtScaleMap; | | class QwtScaleMap; | |
| class QwtScaleDiv; | | class QwtScaleDiv; | |
| | | | |
| /*! | | /*! | |
| \brief A class which draws a coordinate grid | | \brief A class which draws a coordinate grid | |
| | | | |
| The QwtPlotGrid class can be used to draw a coordinate grid. | | The QwtPlotGrid class can be used to draw a coordinate grid. | |
| A coordinate grid consists of major and minor vertical | | A coordinate grid consists of major and minor vertical | |
|
| and horizontal gridlines. The locations of the gridlines | | and horizontal grid lines. The locations of the grid lines | |
| are determined by the X and Y scale divisions which can | | are determined by the X and Y scale divisions which can | |
| be assigned with setXDiv() and setYDiv(). | | be assigned with setXDiv() and setYDiv(). | |
| The draw() member draws the grid within a bounding | | The draw() member draws the grid within a bounding | |
| rectangle. | | rectangle. | |
| */ | | */ | |
| | | | |
| class QWT_EXPORT QwtPlotGrid: public QwtPlotItem | | class QWT_EXPORT QwtPlotGrid: public QwtPlotItem | |
| { | | { | |
| public: | | public: | |
| explicit QwtPlotGrid(); | | explicit QwtPlotGrid(); | |
| | | | |
| skipping to change at line 60 | | skipping to change at line 60 | |
| | | | |
| void enableYMin( bool tf ); | | void enableYMin( bool tf ); | |
| bool yMinEnabled() const; | | bool yMinEnabled() const; | |
| | | | |
| void setXDiv( const QwtScaleDiv &sx ); | | void setXDiv( const QwtScaleDiv &sx ); | |
| const QwtScaleDiv &xScaleDiv() const; | | const QwtScaleDiv &xScaleDiv() const; | |
| | | | |
| void setYDiv( const QwtScaleDiv &sy ); | | void setYDiv( const QwtScaleDiv &sy ); | |
| const QwtScaleDiv &yScaleDiv() const; | | const QwtScaleDiv &yScaleDiv() const; | |
| | | | |
|
| void setPen( const QPen &p ); | | void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::Soli | |
| | | dLine ); | |
| | | void setPen( const QPen & ); | |
| | | | |
|
| void setMajPen( const QPen &p ); | | void setMajorPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt: | |
| const QPen& majPen() const; | | :SolidLine ); | |
| | | void setMajorPen( const QPen & ); | |
| void setMinPen( const QPen &p ); | | const QPen& majorPen() const; | |
| const QPen& minPen() const; | | | |
| | | void setMinorPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt: | |
| | | :SolidLine ); | |
| | | void setMinorPen( const QPen &p ); | |
| | | const QPen& minorPen() const; | |
| | | | |
| virtual void draw( QPainter *p, | | virtual void draw( QPainter *p, | |
| const QwtScaleMap &xMap, const QwtScaleMap &yMap, | | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |
| const QRectF &rect ) const; | | const QRectF &rect ) const; | |
| | | | |
| virtual void updateScaleDiv( | | virtual void updateScaleDiv( | |
| const QwtScaleDiv &xMap, const QwtScaleDiv &yMap ); | | const QwtScaleDiv &xMap, const QwtScaleDiv &yMap ); | |
| | | | |
| private: | | private: | |
| void drawLines( QPainter *painter, const QRectF &, | | void drawLines( QPainter *painter, const QRectF &, | |
| | | | |
End of changes. 3 change blocks. |
| 7 lines changed or deleted | | 13 lines changed or added | |
|
| qwt_plot_histogram.h | | qwt_plot_histogram.h | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 35 | |
| is associated with a value ( \f$y = f([x1,x2])\f$ ). | | is associated with a value ( \f$y = f([x1,x2])\f$ ). | |
| | | | |
| The representation depends on the style() and an optional symbol() | | The representation depends on the style() and an optional symbol() | |
| that is displayed for each interval. | | that is displayed for each interval. | |
| | | | |
| \note The term "histogram" is used in a different way in the areas of | | \note The term "histogram" is used in a different way in the areas of | |
| digital image processing and statistics. Wikipedia introduces the | | digital image processing and statistics. Wikipedia introduces the | |
| terms "image histogram" and "color histogram" to avoid confusions. | | terms "image histogram" and "color histogram" to avoid confusions. | |
| While "image histograms" can be displayed by a QwtPlotCurve there | | While "image histograms" can be displayed by a QwtPlotCurve there | |
| is no applicable plot item for a "color histogram" yet. | | is no applicable plot item for a "color histogram" yet. | |
|
| | | | |
| | | \sa QwtPlotBarChart, QwtPlotMultiBarChart | |
| */ | | */ | |
| | | | |
|
| class QWT_EXPORT QwtPlotHistogram: public QwtPlotSeriesItem<QwtIntervalSamp | | class QWT_EXPORT QwtPlotHistogram: | |
| le> | | public QwtPlotSeriesItem, public QwtSeriesStore<QwtIntervalSample> | |
| { | | { | |
| public: | | public: | |
| /*! | | /*! | |
| Histogram styles. | | Histogram styles. | |
| The default style is QwtPlotHistogram::Columns. | | The default style is QwtPlotHistogram::Columns. | |
| | | | |
| \sa setStyle(), style(), setSymbol(), symbol(), setBaseline() | | \sa setStyle(), style(), setSymbol(), symbol(), setBaseline() | |
| */ | | */ | |
| enum HistogramStyle | | enum HistogramStyle | |
| { | | { | |
| | | | |
| skipping to change at line 82 | | skipping to change at line 85 | |
| */ | | */ | |
| UserStyle = 100 | | UserStyle = 100 | |
| }; | | }; | |
| | | | |
| explicit QwtPlotHistogram( const QString &title = QString::null ); | | explicit QwtPlotHistogram( const QString &title = QString::null ); | |
| explicit QwtPlotHistogram( const QwtText &title ); | | explicit QwtPlotHistogram( const QwtText &title ); | |
| virtual ~QwtPlotHistogram(); | | virtual ~QwtPlotHistogram(); | |
| | | | |
| virtual int rtti() const; | | virtual int rtti() const; | |
| | | | |
|
| | | void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::Soli
dLine ); | |
| void setPen( const QPen & ); | | void setPen( const QPen & ); | |
| const QPen &pen() const; | | const QPen &pen() const; | |
| | | | |
| void setBrush( const QBrush & ); | | void setBrush( const QBrush & ); | |
| const QBrush &brush() const; | | const QBrush &brush() const; | |
| | | | |
| void setSamples( const QVector<QwtIntervalSample> & ); | | void setSamples( const QVector<QwtIntervalSample> & ); | |
|
| | | void setSamples( QwtSeriesData<QwtIntervalSample> * ); | |
| | | | |
| void setBaseline( double reference ); | | void setBaseline( double reference ); | |
| double baseline() const; | | double baseline() const; | |
| | | | |
| void setStyle( HistogramStyle style ); | | void setStyle( HistogramStyle style ); | |
| HistogramStyle style() const; | | HistogramStyle style() const; | |
| | | | |
| void setSymbol( const QwtColumnSymbol * ); | | void setSymbol( const QwtColumnSymbol * ); | |
| const QwtColumnSymbol *symbol() const; | | const QwtColumnSymbol *symbol() const; | |
| | | | |
| virtual void drawSeries( QPainter *p, | | virtual void drawSeries( QPainter *p, | |
| const QwtScaleMap &xMap, const QwtScaleMap &yMap, | | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |
| const QRectF &canvasRect, int from, int to ) const; | | const QRectF &canvasRect, int from, int to ) const; | |
| | | | |
| virtual QRectF boundingRect() const; | | virtual QRectF boundingRect() const; | |
| | | | |
|
| virtual void drawLegendIdentifier( QPainter *, const QRectF & ) const; | | virtual QwtGraphic legendIcon( int index, const QSizeF & ) const; | |
| | | | |
| protected: | | protected: | |
| virtual QwtColumnRect columnRect( const QwtIntervalSample &, | | virtual QwtColumnRect columnRect( const QwtIntervalSample &, | |
| const QwtScaleMap &, const QwtScaleMap & ) const; | | const QwtScaleMap &, const QwtScaleMap & ) const; | |
| | | | |
| virtual void drawColumn( QPainter *, const QwtColumnRect &, | | virtual void drawColumn( QPainter *, const QwtColumnRect &, | |
| const QwtIntervalSample & ) const; | | const QwtIntervalSample & ) const; | |
| | | | |
| void drawColumns( QPainter *, | | void drawColumns( QPainter *, | |
| const QwtScaleMap &xMap, const QwtScaleMap &yMap, | | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |
| | | | |
End of changes. 5 change blocks. |
| 3 lines changed or deleted | | 7 lines changed or added | |
|
| qwt_plot_intervalcurve.h | | qwt_plot_intervalcurve.h | |
| | | | |
| skipping to change at line 25 | | skipping to change at line 25 | |
| #include "qwt_series_data.h" | | #include "qwt_series_data.h" | |
| | | | |
| class QwtIntervalSymbol; | | class QwtIntervalSymbol; | |
| | | | |
| /*! | | /*! | |
| \brief QwtPlotIntervalCurve represents a series of samples, where each va
lue | | \brief QwtPlotIntervalCurve represents a series of samples, where each va
lue | |
| is associated with an interval ( \f$[y1,y2] = f(x)\f$ ). | | is associated with an interval ( \f$[y1,y2] = f(x)\f$ ). | |
| | | | |
| The representation depends on the style() and an optional symbol() | | The representation depends on the style() and an optional symbol() | |
| that is displayed for each interval. QwtPlotIntervalCurve might be used | | that is displayed for each interval. QwtPlotIntervalCurve might be used | |
|
| to disply error bars or the area between 2 curves. | | to display error bars or the area between 2 curves. | |
| */ | | */ | |
|
| | | class QWT_EXPORT QwtPlotIntervalCurve: | |
| class QWT_EXPORT QwtPlotIntervalCurve: public QwtPlotSeriesItem<QwtInterval | | public QwtPlotSeriesItem, public QwtSeriesStore<QwtIntervalSample> | |
| Sample> | | | |
| { | | { | |
| public: | | public: | |
| /*! | | /*! | |
| \brief Curve styles. | | \brief Curve styles. | |
| The default setting is QwtPlotIntervalCurve::Tube. | | The default setting is QwtPlotIntervalCurve::Tube. | |
| | | | |
| \sa setStyle(), style() | | \sa setStyle(), style() | |
| */ | | */ | |
|
| | | | |
| enum CurveStyle | | enum CurveStyle | |
| { | | { | |
| /*! | | /*! | |
| Don't draw a curve. Note: This doesn't affect the symbols. | | Don't draw a curve. Note: This doesn't affect the symbols. | |
| */ | | */ | |
| NoCurve, | | NoCurve, | |
| | | | |
| /*! | | /*! | |
| Build 2 curves from the upper and lower limits of the intervals | | Build 2 curves from the upper and lower limits of the intervals | |
| and draw them with the pen(). The area between the curves is | | and draw them with the pen(). The area between the curves is | |
| | | | |
| skipping to change at line 91 | | skipping to change at line 90 | |
| explicit QwtPlotIntervalCurve( const QwtText &title ); | | explicit QwtPlotIntervalCurve( const QwtText &title ); | |
| | | | |
| virtual ~QwtPlotIntervalCurve(); | | virtual ~QwtPlotIntervalCurve(); | |
| | | | |
| virtual int rtti() const; | | virtual int rtti() const; | |
| | | | |
| void setPaintAttribute( PaintAttribute, bool on = true ); | | void setPaintAttribute( PaintAttribute, bool on = true ); | |
| bool testPaintAttribute( PaintAttribute ) const; | | bool testPaintAttribute( PaintAttribute ) const; | |
| | | | |
| void setSamples( const QVector<QwtIntervalSample> & ); | | void setSamples( const QVector<QwtIntervalSample> & ); | |
|
| | | void setSamples( QwtSeriesData<QwtIntervalSample> * ); | |
| | | | |
|
| | | void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::Soli
dLine ); | |
| void setPen( const QPen & ); | | void setPen( const QPen & ); | |
| const QPen &pen() const; | | const QPen &pen() const; | |
| | | | |
| void setBrush( const QBrush & ); | | void setBrush( const QBrush & ); | |
| const QBrush &brush() const; | | const QBrush &brush() const; | |
| | | | |
| void setStyle( CurveStyle style ); | | void setStyle( CurveStyle style ); | |
| CurveStyle style() const; | | CurveStyle style() const; | |
| | | | |
| void setSymbol( const QwtIntervalSymbol * ); | | void setSymbol( const QwtIntervalSymbol * ); | |
| const QwtIntervalSymbol *symbol() const; | | const QwtIntervalSymbol *symbol() const; | |
| | | | |
| virtual void drawSeries( QPainter *p, | | virtual void drawSeries( QPainter *p, | |
| const QwtScaleMap &xMap, const QwtScaleMap &yMap, | | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |
| const QRectF &canvasRect, int from, int to ) const; | | const QRectF &canvasRect, int from, int to ) const; | |
| | | | |
| virtual QRectF boundingRect() const; | | virtual QRectF boundingRect() const; | |
|
| virtual void drawLegendIdentifier( QPainter *, const QRectF & ) const; | | | |
| | | virtual QwtGraphic legendIcon( int index, const QSizeF & ) const; | |
| | | | |
| protected: | | protected: | |
| | | | |
| void init(); | | void init(); | |
| | | | |
| virtual void drawTube( QPainter *, | | virtual void drawTube( QPainter *, | |
| const QwtScaleMap &xMap, const QwtScaleMap &yMap, | | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |
| const QRectF &canvasRect, int from, int to ) const; | | const QRectF &canvasRect, int from, int to ) const; | |
| | | | |
| virtual void drawSymbols( QPainter *, const QwtIntervalSymbol &, | | virtual void drawSymbols( QPainter *, const QwtIntervalSymbol &, | |
| | | | |
End of changes. 6 change blocks. |
| 6 lines changed or deleted | | 7 lines changed or added | |
|
| qwt_plot_item.h | | qwt_plot_item.h | |
| | | | |
| skipping to change at line 14 | | skipping to change at line 14 | |
| * Copyright (C) 2002 Uwe Rathmann | | * Copyright (C) 2002 Uwe Rathmann | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_PLOT_ITEM_H | | #ifndef QWT_PLOT_ITEM_H | |
| #define QWT_PLOT_ITEM_H | | #define QWT_PLOT_ITEM_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
|
| #include "qwt_legend_itemmanager.h" | | | |
| #include "qwt_text.h" | | #include "qwt_text.h" | |
|
| | | #include "qwt_legend_data.h" | |
| | | #include "qwt_graphic.h" | |
| #include <qrect.h> | | #include <qrect.h> | |
|
| | | #include <qlist.h> | |
| | | #include <qmetatype.h> | |
| | | | |
|
| class QString; | | | |
| class QPainter; | | class QPainter; | |
|
| class QWidget; | | | |
| class QwtPlot; | | | |
| class QwtLegend; | | | |
| class QwtScaleMap; | | class QwtScaleMap; | |
| class QwtScaleDiv; | | class QwtScaleDiv; | |
|
| | | class QwtPlot; | |
| | | | |
| /*! | | /*! | |
| \brief Base class for items on the plot canvas | | \brief Base class for items on the plot canvas | |
| | | | |
| A plot item is "something", that can be painted on the plot canvas, | | A plot item is "something", that can be painted on the plot canvas, | |
| or only affects the scales of the plot widget. They can be categorized as
: | | or only affects the scales of the plot widget. They can be categorized as
: | |
| | | | |
| - Representator\n | | - Representator\n | |
| A "Representator" is an item that represents some sort of data | | A "Representator" is an item that represents some sort of data | |
| on the plot canvas. The different representator classes are organized | | on the plot canvas. The different representator classes are organized | |
| | | | |
| skipping to change at line 53 | | skipping to change at line 53 | |
| | | | |
| - Decorators\n | | - Decorators\n | |
| A "Decorator" is an item, that displays additional information, that | | A "Decorator" is an item, that displays additional information, that | |
| is not related to any data: | | is not related to any data: | |
| - QwtPlotGrid | | - QwtPlotGrid | |
| - QwtPlotScaleItem | | - QwtPlotScaleItem | |
| - QwtPlotSvgItem | | - QwtPlotSvgItem | |
| - ... | | - ... | |
| | | | |
| Depending on the QwtPlotItem::ItemAttribute flags, an item is included | | Depending on the QwtPlotItem::ItemAttribute flags, an item is included | |
|
| into autoscaling or has an entry on the legnd. | | into autoscaling or has an entry on the legend. | |
| | | | |
| Before misusing the existing item classes it might be better to | | Before misusing the existing item classes it might be better to | |
| implement a new type of plot item | | implement a new type of plot item | |
| ( don't implement a watermark as spectrogram ). | | ( don't implement a watermark as spectrogram ). | |
| Deriving a new type of QwtPlotItem primarily means to implement | | Deriving a new type of QwtPlotItem primarily means to implement | |
| the YourPlotItem::draw() method. | | the YourPlotItem::draw() method. | |
| | | | |
| \sa The cpuplot example shows the implementation of additional plot items
. | | \sa The cpuplot example shows the implementation of additional plot items
. | |
| */ | | */ | |
| | | | |
|
| class QWT_EXPORT QwtPlotItem: public QwtLegendItemManager | | class QWT_EXPORT QwtPlotItem | |
| { | | { | |
| public: | | public: | |
| /*! | | /*! | |
| \brief Runtime type information | | \brief Runtime type information | |
| | | | |
| RttiValues is used to cast plot items, without | | RttiValues is used to cast plot items, without | |
| having to enable runtime type information of the compiler. | | having to enable runtime type information of the compiler. | |
| */ | | */ | |
| enum RttiValues | | enum RttiValues | |
| { | | { | |
| //! Unspecific value, that can be used, when it doesn't matter | | //! Unspecific value, that can be used, when it doesn't matter | |
| Rtti_PlotItem = 0, | | Rtti_PlotItem = 0, | |
| | | | |
| //! For QwtPlotGrid | | //! For QwtPlotGrid | |
| Rtti_PlotGrid, | | Rtti_PlotGrid, | |
| | | | |
| //! For QwtPlotScaleItem | | //! For QwtPlotScaleItem | |
| Rtti_PlotScale, | | Rtti_PlotScale, | |
| | | | |
|
| | | //! For QwtPlotLegendItem | |
| | | Rtti_PlotLegend, | |
| | | | |
| //! For QwtPlotMarker | | //! For QwtPlotMarker | |
| Rtti_PlotMarker, | | Rtti_PlotMarker, | |
| | | | |
| //! For QwtPlotCurve | | //! For QwtPlotCurve | |
| Rtti_PlotCurve, | | Rtti_PlotCurve, | |
| | | | |
| //! For QwtPlotSpectroCurve | | //! For QwtPlotSpectroCurve | |
| Rtti_PlotSpectroCurve, | | Rtti_PlotSpectroCurve, | |
| | | | |
| //! For QwtPlotIntervalCurve | | //! For QwtPlotIntervalCurve | |
| | | | |
| skipping to change at line 105 | | skipping to change at line 108 | |
| | | | |
| //! For QwtPlotHistogram | | //! For QwtPlotHistogram | |
| Rtti_PlotHistogram, | | Rtti_PlotHistogram, | |
| | | | |
| //! For QwtPlotSpectrogram | | //! For QwtPlotSpectrogram | |
| Rtti_PlotSpectrogram, | | Rtti_PlotSpectrogram, | |
| | | | |
| //! For QwtPlotSvgItem | | //! For QwtPlotSvgItem | |
| Rtti_PlotSVG, | | Rtti_PlotSVG, | |
| | | | |
|
| | | //! For QwtPlotTradingCurve | |
| | | Rtti_PlotTradingCurve, | |
| | | | |
| | | //! For QwtPlotBarChart | |
| | | Rtti_PlotBarChart, | |
| | | | |
| | | //! For QwtPlotMultiBarChart | |
| | | Rtti_PlotMultiBarChart, | |
| | | | |
| | | //! For QwtPlotShapeItem | |
| | | Rtti_PlotShape, | |
| | | | |
| | | //! For QwtPlotTextLabel | |
| | | Rtti_PlotTextLabel, | |
| | | | |
| | | //! For QwtPlotZoneItem | |
| | | Rtti_PlotZone, | |
| | | | |
| /*! | | /*! | |
| Values >= Rtti_PlotUserItem are reserved for plot items | | Values >= Rtti_PlotUserItem are reserved for plot items | |
| not implemented in the Qwt library. | | not implemented in the Qwt library. | |
| */ | | */ | |
| Rtti_PlotUserItem = 1000 | | Rtti_PlotUserItem = 1000 | |
| }; | | }; | |
| | | | |
| /*! | | /*! | |
|
| Plot Item Attributes | | \brief Plot Item Attributes | |
| \sa setItemAttribute(), testItemAttribute() | | | |
| | | Various aspects of a plot widget depend on the attributes of | |
| | | the attached plot items. If and how a single plot item | |
| | | participates in these updates depends on its attributes. | |
| | | | |
| | | \sa setItemAttribute(), testItemAttribute(), ItemInterest | |
| */ | | */ | |
| enum ItemAttribute | | enum ItemAttribute | |
| { | | { | |
| //! The item is represented on the legend. | | //! The item is represented on the legend. | |
| Legend = 0x01, | | Legend = 0x01, | |
| | | | |
| /*! | | /*! | |
|
| The boundingRect() of the item is included in the | | The boundingRect() of the item is included in the | |
| autoscaling calculation. | | autoscaling calculation as long as its width or height | |
| | | is >= 0.0. | |
| */ | | */ | |
|
| AutoScale = 0x02 | | AutoScale = 0x02, | |
| | | | |
| | | /*! | |
| | | The item needs extra space to display something outside | |
| | | its bounding rectangle. | |
| | | \sa getCanvasMarginHint() | |
| | | */ | |
| | | Margins = 0x04 | |
| }; | | }; | |
| | | | |
| //! Plot Item Attributes | | //! Plot Item Attributes | |
| typedef QFlags<ItemAttribute> ItemAttributes; | | typedef QFlags<ItemAttribute> ItemAttributes; | |
| | | | |
|
| | | /*! | |
| | | \brief Plot Item Interests | |
| | | | |
| | | Plot items might depend on the situation of the corresponding | |
| | | plot widget. By enabling an interest the plot item will be | |
| | | notified, when the corresponding attribute of the plot widgets | |
| | | has changed. | |
| | | | |
| | | \sa setItemAttribute(), testItemAttribute(), ItemInterest | |
| | | */ | |
| | | enum ItemInterest | |
| | | { | |
| | | /*! | |
| | | The item is interested in updates of the scales | |
| | | \sa updateScaleDiv() | |
| | | */ | |
| | | ScaleInterest = 0x01, | |
| | | | |
| | | /*! | |
| | | The item is interested in updates of the legend ( of other items | |
| | | ) | |
| | | This flag is intended for items, that want to implement a legend | |
| | | for displaying entries of other plot item. | |
| | | | |
| | | \note If the plot item wants to be represented on a legend | |
| | | enable QwtPlotItem::Legend instead. | |
| | | | |
| | | \sa updateLegend() | |
| | | */ | |
| | | LegendInterest = 0x02 | |
| | | }; | |
| | | | |
| | | //! Plot Item Interests | |
| | | typedef QFlags<ItemInterest> ItemInterests; | |
| | | | |
| //! Render hints | | //! Render hints | |
| enum RenderHint | | enum RenderHint | |
| { | | { | |
| //! Enable antialiasing | | //! Enable antialiasing | |
|
| RenderAntialiased = 1 | | RenderAntialiased = 0x1 | |
| }; | | }; | |
| | | | |
| //! Render hints | | //! Render hints | |
| typedef QFlags<RenderHint> RenderHints; | | typedef QFlags<RenderHint> RenderHints; | |
| | | | |
| explicit QwtPlotItem( const QwtText &title = QwtText() ); | | explicit QwtPlotItem( const QwtText &title = QwtText() ); | |
| virtual ~QwtPlotItem(); | | virtual ~QwtPlotItem(); | |
| | | | |
| void attach( QwtPlot *plot ); | | void attach( QwtPlot *plot ); | |
| void detach(); | | void detach(); | |
| | | | |
| skipping to change at line 158 | | skipping to change at line 226 | |
| | | | |
| void setTitle( const QString &title ); | | void setTitle( const QString &title ); | |
| void setTitle( const QwtText &title ); | | void setTitle( const QwtText &title ); | |
| const QwtText &title() const; | | const QwtText &title() const; | |
| | | | |
| virtual int rtti() const; | | virtual int rtti() const; | |
| | | | |
| void setItemAttribute( ItemAttribute, bool on = true ); | | void setItemAttribute( ItemAttribute, bool on = true ); | |
| bool testItemAttribute( ItemAttribute ) const; | | bool testItemAttribute( ItemAttribute ) const; | |
| | | | |
|
| | | void setItemInterest( ItemInterest, bool on = true ); | |
| | | bool testItemInterest( ItemInterest ) const; | |
| | | | |
| void setRenderHint( RenderHint, bool on = true ); | | void setRenderHint( RenderHint, bool on = true ); | |
| bool testRenderHint( RenderHint ) const; | | bool testRenderHint( RenderHint ) const; | |
| | | | |
|
| | | void setRenderThreadCount( uint numThreads ); | |
| | | uint renderThreadCount() const; | |
| | | | |
| | | void setLegendIconSize( const QSize & ); | |
| | | QSize legendIconSize() const; | |
| | | | |
| double z() const; | | double z() const; | |
| void setZ( double z ); | | void setZ( double z ); | |
| | | | |
| void show(); | | void show(); | |
| void hide(); | | void hide(); | |
| virtual void setVisible( bool ); | | virtual void setVisible( bool ); | |
| bool isVisible () const; | | bool isVisible () const; | |
| | | | |
| void setAxes( int xAxis, int yAxis ); | | void setAxes( int xAxis, int yAxis ); | |
| | | | |
| void setXAxis( int axis ); | | void setXAxis( int axis ); | |
| int xAxis() const; | | int xAxis() const; | |
| | | | |
| void setYAxis( int axis ); | | void setYAxis( int axis ); | |
| int yAxis() const; | | int yAxis() const; | |
| | | | |
| virtual void itemChanged(); | | virtual void itemChanged(); | |
|
| | | virtual void legendChanged(); | |
| | | | |
| /*! | | /*! | |
| \brief Draw the item | | \brief Draw the item | |
| | | | |
| \param painter Painter | | \param painter Painter | |
| \param xMap Maps x-values into pixel coordinates. | | \param xMap Maps x-values into pixel coordinates. | |
| \param yMap Maps y-values into pixel coordinates. | | \param yMap Maps y-values into pixel coordinates. | |
| \param canvasRect Contents rect of the canvas in painter coordinates | | \param canvasRect Contents rect of the canvas in painter coordinates | |
| */ | | */ | |
| virtual void draw( QPainter *painter, | | virtual void draw( QPainter *painter, | |
| const QwtScaleMap &xMap, const QwtScaleMap &yMap, | | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |
| const QRectF &canvasRect ) const = 0; | | const QRectF &canvasRect ) const = 0; | |
| | | | |
| virtual QRectF boundingRect() const; | | virtual QRectF boundingRect() const; | |
| | | | |
|
| virtual void updateLegend( QwtLegend * ) const; | | virtual void getCanvasMarginHint( | |
| | | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |
| | | const QRectF &canvasSize, | |
| | | double &left, double &top, double &right, double &bottom) const; | |
| | | | |
| virtual void updateScaleDiv( | | virtual void updateScaleDiv( | |
| const QwtScaleDiv&, const QwtScaleDiv& ); | | const QwtScaleDiv&, const QwtScaleDiv& ); | |
| | | | |
|
| virtual QWidget *legendItem() const; | | virtual void updateLegend( const QwtPlotItem *, | |
| | | const QList<QwtLegendData> & ); | |
| | | | |
| QRectF scaleRect( const QwtScaleMap &, const QwtScaleMap & ) const; | | QRectF scaleRect( const QwtScaleMap &, const QwtScaleMap & ) const; | |
| QRectF paintRect( const QwtScaleMap &, const QwtScaleMap & ) const; | | QRectF paintRect( const QwtScaleMap &, const QwtScaleMap & ) const; | |
| | | | |
|
| | | virtual QList<QwtLegendData> legendData() const; | |
| | | | |
| | | virtual QwtGraphic legendIcon( int index, const QSizeF & ) const; | |
| | | | |
| | | protected: | |
| | | QwtGraphic defaultIcon( const QBrush &, const QSizeF & ) const; | |
| | | | |
| private: | | private: | |
| // Disabled copy constructor and operator= | | // Disabled copy constructor and operator= | |
| QwtPlotItem( const QwtPlotItem & ); | | QwtPlotItem( const QwtPlotItem & ); | |
| QwtPlotItem &operator=( const QwtPlotItem & ); | | QwtPlotItem &operator=( const QwtPlotItem & ); | |
| | | | |
| class PrivateData; | | class PrivateData; | |
| PrivateData *d_data; | | PrivateData *d_data; | |
| }; | | }; | |
| | | | |
| Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotItem::ItemAttributes ) | | Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotItem::ItemAttributes ) | |
|
| | | Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotItem::ItemInterests ) | |
| Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotItem::RenderHints ) | | Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotItem::RenderHints ) | |
| | | | |
|
| | | Q_DECLARE_METATYPE( QwtPlotItem * ) | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 23 change blocks. |
| 15 lines changed or deleted | | 109 lines changed or added | |
|
| qwt_plot_layout.h | | qwt_plot_layout.h | |
| | | | |
| skipping to change at line 22 | | skipping to change at line 22 | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include "qwt_plot.h" | | #include "qwt_plot.h" | |
| | | | |
| /*! | | /*! | |
| \brief Layout engine for QwtPlot. | | \brief Layout engine for QwtPlot. | |
| | | | |
| It is used by the QwtPlot widget to organize its internal widgets | | It is used by the QwtPlot widget to organize its internal widgets | |
| or by QwtPlot::print() to render its content to a QPaintDevice like | | or by QwtPlot::print() to render its content to a QPaintDevice like | |
| a QPrinter, QPixmap/QImage or QSvgRenderer. | | a QPrinter, QPixmap/QImage or QSvgRenderer. | |
|
| | | | |
| | | \sa QwtPlot::setPlotLayout() | |
| */ | | */ | |
| | | | |
| class QWT_EXPORT QwtPlotLayout | | class QWT_EXPORT QwtPlotLayout | |
| { | | { | |
| public: | | public: | |
| /*! | | /*! | |
| Options to configure the plot layout engine | | Options to configure the plot layout engine | |
| \sa activate(), QwtPlotRenderer | | \sa activate(), QwtPlotRenderer | |
| */ | | */ | |
| enum Option | | enum Option | |
| | | | |
| skipping to change at line 46 | | skipping to change at line 48 | |
| /*! | | /*! | |
| Ignore the dimension of the scrollbars. There are no | | Ignore the dimension of the scrollbars. There are no | |
| scrollbars, when the plot is not rendered to widgets. | | scrollbars, when the plot is not rendered to widgets. | |
| */ | | */ | |
| IgnoreScrollbars = 0x02, | | IgnoreScrollbars = 0x02, | |
| | | | |
| //! Ignore all frames. | | //! Ignore all frames. | |
| IgnoreFrames = 0x04, | | IgnoreFrames = 0x04, | |
| | | | |
| //! Ignore the legend. | | //! Ignore the legend. | |
|
| IgnoreLegend = 0x08 | | IgnoreLegend = 0x08, | |
| | | | |
| | | //! Ignore the title. | |
| | | IgnoreTitle = 0x10, | |
| | | | |
| | | //! Ignore the footer. | |
| | | IgnoreFooter = 0x20 | |
| }; | | }; | |
| | | | |
| //! Layout options | | //! Layout options | |
| typedef QFlags<Option> Options; | | typedef QFlags<Option> Options; | |
| | | | |
| explicit QwtPlotLayout(); | | explicit QwtPlotLayout(); | |
| virtual ~QwtPlotLayout(); | | virtual ~QwtPlotLayout(); | |
| | | | |
| void setCanvasMargin( int margin, int axis = -1 ); | | void setCanvasMargin( int margin, int axis = -1 ); | |
| int canvasMargin( int axis ) const; | | int canvasMargin( int axis ) const; | |
| | | | |
| void setAlignCanvasToScales( bool ); | | void setAlignCanvasToScales( bool ); | |
|
| bool alignCanvasToScales() const; | | | |
| | | void setAlignCanvasToScale( int axisId, bool ); | |
| | | bool alignCanvasToScale( int axisId ) const; | |
| | | | |
| void setSpacing( int ); | | void setSpacing( int ); | |
| int spacing() const; | | int spacing() const; | |
| | | | |
| void setLegendPosition( QwtPlot::LegendPosition pos, double ratio ); | | void setLegendPosition( QwtPlot::LegendPosition pos, double ratio ); | |
| void setLegendPosition( QwtPlot::LegendPosition pos ); | | void setLegendPosition( QwtPlot::LegendPosition pos ); | |
| QwtPlot::LegendPosition legendPosition() const; | | QwtPlot::LegendPosition legendPosition() const; | |
| | | | |
| void setLegendRatio( double ratio ); | | void setLegendRatio( double ratio ); | |
| double legendRatio() const; | | double legendRatio() const; | |
| | | | |
| virtual QSize minimumSizeHint( const QwtPlot * ) const; | | virtual QSize minimumSizeHint( const QwtPlot * ) const; | |
| | | | |
| virtual void activate( const QwtPlot *, | | virtual void activate( const QwtPlot *, | |
| const QRectF &rect, Options options = 0x00 ); | | const QRectF &rect, Options options = 0x00 ); | |
| | | | |
| virtual void invalidate(); | | virtual void invalidate(); | |
| | | | |
|
| const QRectF &titleRect() const; | | QRectF titleRect() const; | |
| const QRectF &legendRect() const; | | QRectF footerRect() const; | |
| const QRectF &scaleRect( int axis ) const; | | QRectF legendRect() const; | |
| const QRectF &canvasRect() const; | | QRectF scaleRect( int axis ) const; | |
| | | QRectF canvasRect() const; | |
| | | | |
| class LayoutData; | | class LayoutData; | |
| | | | |
| protected: | | protected: | |
| | | | |
|
| | | void setTitleRect( const QRectF & ); | |
| | | void setFooterRect( const QRectF & ); | |
| | | void setLegendRect( const QRectF & ); | |
| | | void setScaleRect( int axis, const QRectF & ); | |
| | | void setCanvasRect( const QRectF & ); | |
| | | | |
| QRectF layoutLegend( Options options, const QRectF & ) const; | | QRectF layoutLegend( Options options, const QRectF & ) const; | |
| QRectF alignLegend( const QRectF &canvasRect, | | QRectF alignLegend( const QRectF &canvasRect, | |
| const QRectF &legendRect ) const; | | const QRectF &legendRect ) const; | |
| | | | |
|
| void expandLineBreaks( int options, const QRectF &rect, | | void expandLineBreaks( Options options, const QRectF &rect, | |
| int &dimTitle, int dimAxes[QwtPlot::axisCnt] ) const; | | int &dimTitle, int &dimFooter, int dimAxes[QwtPlot::axisCnt] ) cons | |
| | | t; | |
| | | | |
|
| void alignScales( int options, QRectF &canvasRect, | | void alignScales( Options options, QRectF &canvasRect, | |
| QRectF scaleRect[QwtPlot::axisCnt] ) const; | | QRectF scaleRect[QwtPlot::axisCnt] ) const; | |
| | | | |
| private: | | private: | |
| class PrivateData; | | class PrivateData; | |
| | | | |
| PrivateData *d_data; | | PrivateData *d_data; | |
| }; | | }; | |
| | | | |
| Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotLayout::Options ) | | Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotLayout::Options ) | |
| | | | |
| | | | |
End of changes. 7 change blocks. |
| 9 lines changed or deleted | | 27 lines changed or added | |
|
| qwt_plot_marker.h | | qwt_plot_marker.h | |
| | | | |
| skipping to change at line 31 | | skipping to change at line 31 | |
| class QwtText; | | class QwtText; | |
| class QwtSymbol; | | class QwtSymbol; | |
| | | | |
| /*! | | /*! | |
| \brief A class for drawing markers | | \brief A class for drawing markers | |
| | | | |
| A marker can be a horizontal line, a vertical line, | | A marker can be a horizontal line, a vertical line, | |
| a symbol, a label or any combination of them, which can | | a symbol, a label or any combination of them, which can | |
| be drawn around a center point inside a bounding rectangle. | | be drawn around a center point inside a bounding rectangle. | |
| | | | |
|
| The QwtPlotMarker::setSymbol() member assigns a symbol to the marker. | | The setSymbol() member assigns a symbol to the marker. | |
| The symbol is drawn at the specified point. | | The symbol is drawn at the specified point. | |
| | | | |
| With setLabel(), a label can be assigned to the marker. | | With setLabel(), a label can be assigned to the marker. | |
| The setLabelAlignment() member specifies where the label is | | The setLabelAlignment() member specifies where the label is | |
| drawn. All the Align*-constants in Qt::AlignmentFlags (see Qt documentati
on) | | drawn. All the Align*-constants in Qt::AlignmentFlags (see Qt documentati
on) | |
| are valid. The interpretation of the alignment depends on the marker's | | are valid. The interpretation of the alignment depends on the marker's | |
| line style. The alignment refers to the center point of | | line style. The alignment refers to the center point of | |
| the marker, which means, for example, that the label would be printed | | the marker, which means, for example, that the label would be printed | |
| left above the center point if the alignment was set to | | left above the center point if the alignment was set to | |
| Qt::AlignLeft | Qt::AlignTop. | | Qt::AlignLeft | Qt::AlignTop. | |
|
| | | | |
| | | \note QwtPlotTextLabel is intended to align a text label | |
| | | according to the geometry of canvas | |
| | | ( unrelated to plot coordinates ) | |
| */ | | */ | |
| | | | |
| class QWT_EXPORT QwtPlotMarker: public QwtPlotItem | | class QWT_EXPORT QwtPlotMarker: public QwtPlotItem | |
| { | | { | |
| public: | | public: | |
| | | | |
| /*! | | /*! | |
| Line styles. | | Line styles. | |
| \sa setLineStyle(), lineStyle() | | \sa setLineStyle(), lineStyle() | |
| */ | | */ | |
| | | | |
| skipping to change at line 67 | | skipping to change at line 71 | |
| //! A horizontal line | | //! A horizontal line | |
| HLine, | | HLine, | |
| | | | |
| //! A vertical line | | //! A vertical line | |
| VLine, | | VLine, | |
| | | | |
| //! A crosshair | | //! A crosshair | |
| Cross | | Cross | |
| }; | | }; | |
| | | | |
|
| explicit QwtPlotMarker(); | | explicit QwtPlotMarker( const QString &title = QString::null ); | |
| | | explicit QwtPlotMarker( const QwtText &title ); | |
| | | | |
| virtual ~QwtPlotMarker(); | | virtual ~QwtPlotMarker(); | |
| | | | |
| virtual int rtti() const; | | virtual int rtti() const; | |
| | | | |
| double xValue() const; | | double xValue() const; | |
| double yValue() const; | | double yValue() const; | |
| QPointF value() const; | | QPointF value() const; | |
| | | | |
| void setXValue( double ); | | void setXValue( double ); | |
| void setYValue( double ); | | void setYValue( double ); | |
| void setValue( double, double ); | | void setValue( double, double ); | |
| void setValue( const QPointF & ); | | void setValue( const QPointF & ); | |
| | | | |
| void setLineStyle( LineStyle st ); | | void setLineStyle( LineStyle st ); | |
| LineStyle lineStyle() const; | | LineStyle lineStyle() const; | |
| | | | |
|
| | | void setLinePen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::
SolidLine ); | |
| void setLinePen( const QPen &p ); | | void setLinePen( const QPen &p ); | |
| const QPen &linePen() const; | | const QPen &linePen() const; | |
| | | | |
| void setSymbol( const QwtSymbol * ); | | void setSymbol( const QwtSymbol * ); | |
| const QwtSymbol *symbol() const; | | const QwtSymbol *symbol() const; | |
| | | | |
| void setLabel( const QwtText& ); | | void setLabel( const QwtText& ); | |
| QwtText label() const; | | QwtText label() const; | |
| | | | |
| void setLabelAlignment( Qt::Alignment ); | | void setLabelAlignment( Qt::Alignment ); | |
| | | | |
| skipping to change at line 108 | | skipping to change at line 115 | |
| | | | |
| void setSpacing( int ); | | void setSpacing( int ); | |
| int spacing() const; | | int spacing() const; | |
| | | | |
| virtual void draw( QPainter *p, | | virtual void draw( QPainter *p, | |
| const QwtScaleMap &xMap, const QwtScaleMap &yMap, | | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |
| const QRectF & ) const; | | const QRectF & ) const; | |
| | | | |
| virtual QRectF boundingRect() const; | | virtual QRectF boundingRect() const; | |
| | | | |
|
| virtual void updateLegend( QwtLegend * ) const; | | virtual QwtGraphic legendIcon( int index, const QSizeF & ) const; | |
| virtual void drawLegendIdentifier( QPainter *, const QRectF & ) const; | | | |
| | | | |
| protected: | | protected: | |
| virtual void drawLines( QPainter *, | | virtual void drawLines( QPainter *, | |
| const QRectF &, const QPointF & ) const; | | const QRectF &, const QPointF & ) const; | |
| | | | |
| virtual void drawLabel( QPainter *, | | virtual void drawLabel( QPainter *, | |
| const QRectF &, const QPointF & ) const; | | const QRectF &, const QPointF & ) const; | |
| | | | |
| private: | | private: | |
| | | | |
| | | | |
End of changes. 5 change blocks. |
| 4 lines changed or deleted | | 10 lines changed or added | |
|
| qwt_plot_picker.h | | qwt_plot_picker.h | |
| | | | |
| skipping to change at line 14 | | skipping to change at line 14 | |
| * Copyright (C) 2002 Uwe Rathmann | | * Copyright (C) 2002 Uwe Rathmann | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_PLOT_PICKER_H | | #ifndef QWT_PLOT_PICKER_H | |
| #define QWT_PLOT_PICKER_H | | #define QWT_PLOT_PICKER_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
|
| #include "qwt_plot_canvas.h" | | | |
| #include "qwt_picker.h" | | #include "qwt_picker.h" | |
| #include <qvector.h> | | #include <qvector.h> | |
| | | | |
| class QwtPlot; | | class QwtPlot; | |
| | | | |
| /*! | | /*! | |
| \brief QwtPlotPicker provides selections on a plot canvas | | \brief QwtPlotPicker provides selections on a plot canvas | |
| | | | |
| QwtPlotPicker is a QwtPicker tailored for selections on | | QwtPlotPicker is a QwtPicker tailored for selections on | |
| a plot canvas. It is set to a x-Axis and y-Axis and | | a plot canvas. It is set to a x-Axis and y-Axis and | |
|
| translates all pixel coordinates into this coodinate system. | | translates all pixel coordinates into this coordinate system. | |
| */ | | */ | |
| | | | |
| class QWT_EXPORT QwtPlotPicker: public QwtPicker | | class QWT_EXPORT QwtPlotPicker: public QwtPicker | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| | | | |
| public: | | public: | |
|
| explicit QwtPlotPicker( QwtPlotCanvas * ); | | explicit QwtPlotPicker( QWidget *canvas ); | |
| virtual ~QwtPlotPicker(); | | virtual ~QwtPlotPicker(); | |
| | | | |
|
| explicit QwtPlotPicker( int xAxis, int yAxis, QwtPlotCanvas * ); | | explicit QwtPlotPicker( int xAxis, int yAxis, QWidget * ); | |
| | | | |
| explicit QwtPlotPicker( int xAxis, int yAxis, | | explicit QwtPlotPicker( int xAxis, int yAxis, | |
|
| RubberBand rubberBand, DisplayMode trackerMode, | | RubberBand rubberBand, DisplayMode trackerMode, QWidget * ); | |
| QwtPlotCanvas * ); | | | |
| | | | |
| virtual void setAxis( int xAxis, int yAxis ); | | virtual void setAxis( int xAxis, int yAxis ); | |
| | | | |
| int xAxis() const; | | int xAxis() const; | |
| int yAxis() const; | | int yAxis() const; | |
| | | | |
| QwtPlot *plot(); | | QwtPlot *plot(); | |
| const QwtPlot *plot() const; | | const QwtPlot *plot() const; | |
| | | | |
|
| QwtPlotCanvas *canvas(); | | QWidget *canvas(); | |
| const QwtPlotCanvas *canvas() const; | | const QWidget *canvas() const; | |
| | | | |
| Q_SIGNALS: | | Q_SIGNALS: | |
| | | | |
| /*! | | /*! | |
|
| A signal emitted in case of selectionFlags() & PointSelection. | | A signal emitted in case of QwtPickerMachine::PointSelection. | |
| \param pos Selected point | | \param pos Selected point | |
| */ | | */ | |
| void selected( const QPointF &pos ); | | void selected( const QPointF &pos ); | |
| | | | |
| /*! | | /*! | |
|
| A signal emitted in case of selectionFlags() & RectSelection. | | A signal emitted in case of QwtPickerMachine::RectSelection. | |
| \param rect Selected rectangle | | \param rect Selected rectangle | |
| */ | | */ | |
| void selected( const QRectF &rect ); | | void selected( const QRectF &rect ); | |
| | | | |
| /*! | | /*! | |
| A signal emitting the selected points, | | A signal emitting the selected points, | |
| at the end of a selection. | | at the end of a selection. | |
| | | | |
| \param pa Selected points | | \param pa Selected points | |
| */ | | */ | |
| | | | |
End of changes. 8 change blocks. |
| 10 lines changed or deleted | | 8 lines changed or added | |
|
| qwt_plot_rasteritem.h | | qwt_plot_rasteritem.h | |
| | | | |
| skipping to change at line 41 | | skipping to change at line 41 | |
| QwtPlotRasterItem is only implemented for images of the following formats
: | | QwtPlotRasterItem is only implemented for images of the following formats
: | |
| QImage::Format_Indexed8, QImage::Format_ARGB32. | | QImage::Format_Indexed8, QImage::Format_ARGB32. | |
| | | | |
| \sa QwtPlotSpectrogram | | \sa QwtPlotSpectrogram | |
| */ | | */ | |
| | | | |
| class QWT_EXPORT QwtPlotRasterItem: public QwtPlotItem | | class QWT_EXPORT QwtPlotRasterItem: public QwtPlotItem | |
| { | | { | |
| public: | | public: | |
| /*! | | /*! | |
|
| - NoCache\n | | \brief Cache policy | |
| renderImage() is called, whenever the item has to be repainted | | | |
| - PaintCache\n | | | |
| renderImage() is called, whenever the image cache is not valid, | | | |
| or the scales, or the size of the canvas has changed. This type | | | |
| of cache is only useful for improving the performance of hide/show | | | |
| operations. All other situations are already handled by the | | | |
| plot canvas cache. | | | |
| | | | |
| The default policy is NoCache | | The default policy is NoCache | |
| */ | | */ | |
| enum CachePolicy | | enum CachePolicy | |
| { | | { | |
|
| | | /*! | |
| | | renderImage() is called each time the item has to be repainted | |
| | | */ | |
| NoCache, | | NoCache, | |
|
| | | | |
| | | /*! | |
| | | renderImage() is called, whenever the image cache is not valid, | |
| | | or the scales, or the size of the canvas has changed. | |
| | | | |
| | | This type of cache is useful for improving the performance | |
| | | of hide/show operations or manipulations of the alpha value. | |
| | | All other situations are handled by the canvas backing store. | |
| | | */ | |
| PaintCache | | PaintCache | |
| }; | | }; | |
| | | | |
| /*! | | /*! | |
| Attributes to modify the drawing algorithm. | | Attributes to modify the drawing algorithm. | |
| \sa setPaintAttribute(), testPaintAttribute() | | \sa setPaintAttribute(), testPaintAttribute() | |
| */ | | */ | |
| enum PaintAttribute | | enum PaintAttribute | |
| { | | { | |
| /*! | | /*! | |
| | | | |
| skipping to change at line 120 | | skipping to change at line 124 | |
| An implementation of render() might iterate over all | | An implementation of render() might iterate over all | |
| pixels of imageRect. Each pixel has to be translated into | | pixels of imageRect. Each pixel has to be translated into | |
| the corresponding position in scale coordinates using the maps. | | the corresponding position in scale coordinates using the maps. | |
| This position can be used to look up a value in a implementation | | This position can be used to look up a value in a implementation | |
| specific way and to map it into a color. | | specific way and to map it into a color. | |
| | | | |
| \param xMap X-Scale Map | | \param xMap X-Scale Map | |
| \param yMap Y-Scale Map | | \param yMap Y-Scale Map | |
| \param area Requested area for the image in scale coordinates | | \param area Requested area for the image in scale coordinates | |
| \param imageSize Requested size of the image | | \param imageSize Requested size of the image | |
|
| | | | |
| | | \return Rendered image | |
| */ | | */ | |
| virtual QImage renderImage( const QwtScaleMap &xMap, | | virtual QImage renderImage( const QwtScaleMap &xMap, | |
| const QwtScaleMap &yMap, const QRectF &area, | | const QwtScaleMap &yMap, const QRectF &area, | |
| const QSize &imageSize ) const = 0; | | const QSize &imageSize ) const = 0; | |
| | | | |
| virtual QwtScaleMap imageMap( Qt::Orientation, | | virtual QwtScaleMap imageMap( Qt::Orientation, | |
| const QwtScaleMap &map, const QRectF &area, | | const QwtScaleMap &map, const QRectF &area, | |
| const QSize &imageSize, double pixelSize) const; | | const QSize &imageSize, double pixelSize) const; | |
| | | | |
| private: | | private: | |
| | | | |
End of changes. 4 change blocks. |
| 9 lines changed or deleted | | 15 lines changed or added | |
|
| qwt_plot_renderer.h | | qwt_plot_renderer.h | |
| | | | |
| skipping to change at line 15 | | skipping to change at line 15 | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_PLOT_RENDERER_H | | #ifndef QWT_PLOT_RENDERER_H | |
| #define QWT_PLOT_RENDERER_H | | #define QWT_PLOT_RENDERER_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include <qobject.h> | | #include <qobject.h> | |
|
| | | #include <qsize.h> | |
| | | | |
| class QwtPlot; | | class QwtPlot; | |
| class QwtScaleMap; | | class QwtScaleMap; | |
|
| class QSizeF; | | | |
| class QRectF; | | class QRectF; | |
| class QPainter; | | class QPainter; | |
| class QPaintDevice; | | class QPaintDevice; | |
| | | | |
| #ifndef QT_NO_PRINTER | | #ifndef QT_NO_PRINTER | |
| class QPrinter; | | class QPrinter; | |
| #endif | | #endif | |
| | | | |
| #ifndef QWT_NO_SVG | | #ifndef QWT_NO_SVG | |
| #ifdef QT_SVG_LIB | | #ifdef QT_SVG_LIB | |
| | | | |
| skipping to change at line 58 | | skipping to change at line 58 | |
| //! Don't render the background of the plot | | //! Don't render the background of the plot | |
| DiscardBackground = 0x01, | | DiscardBackground = 0x01, | |
| | | | |
| //! Don't render the title of the plot | | //! Don't render the title of the plot | |
| DiscardTitle = 0x02, | | DiscardTitle = 0x02, | |
| | | | |
| //! Don't render the legend of the plot | | //! Don't render the legend of the plot | |
| DiscardLegend = 0x04, | | DiscardLegend = 0x04, | |
| | | | |
| //! Don't render the background of the canvas | | //! Don't render the background of the canvas | |
|
| DiscardCanvasBackground = 0x08 | | DiscardCanvasBackground = 0x08, | |
| | | | |
| | | //! Don't render the footer of the plot | |
| | | DiscardFooter = 0x10, | |
| | | | |
| | | /*! | |
| | | Don't render the frame of the canvas | |
| | | | |
| | | \note This flag has no effect when using | |
| | | style sheets, where the frame is part | |
| | | of the background | |
| | | */ | |
| | | DiscardCanvasFrame = 0x20 | |
| | | | |
| }; | | }; | |
| | | | |
| //! Disard flags | | //! Disard flags | |
| typedef QFlags<DiscardFlag> DiscardFlags; | | typedef QFlags<DiscardFlag> DiscardFlags; | |
| | | | |
| /*! | | /*! | |
| \brief Layout flags | | \brief Layout flags | |
| \sa setLayoutFlag(), testLayoutFlag() | | \sa setLayoutFlag(), testLayoutFlag() | |
| */ | | */ | |
| enum LayoutFlag | | enum LayoutFlag | |
| { | | { | |
|
| //! Use the default layout without margins and frames | | //! Use the default layout as on screen | |
| DefaultLayout = 0x00, | | DefaultLayout = 0x00, | |
| | | | |
| /*! | | /*! | |
|
| Render all frames of the plot | | | |
| \note Not supported yet | | | |
| */ | | | |
| KeepFrames = 0x01, | | | |
| | | | |
| /*! | | | |
| Instead of the scales a box is painted around the plot canvas, | | Instead of the scales a box is painted around the plot canvas, | |
| where the scale ticks are aligned to. | | where the scale ticks are aligned to. | |
| */ | | */ | |
|
| FrameWithScales = 0x02 | | FrameWithScales = 0x01 | |
| }; | | }; | |
| | | | |
| //! Layout flags | | //! Layout flags | |
| typedef QFlags<LayoutFlag> LayoutFlags; | | typedef QFlags<LayoutFlag> LayoutFlags; | |
| | | | |
| explicit QwtPlotRenderer( QObject * = NULL ); | | explicit QwtPlotRenderer( QObject * = NULL ); | |
| virtual ~QwtPlotRenderer(); | | virtual ~QwtPlotRenderer(); | |
| | | | |
| void setDiscardFlag( DiscardFlag flag, bool on = true ); | | void setDiscardFlag( DiscardFlag flag, bool on = true ); | |
| bool testDiscardFlag( DiscardFlag flag ) const; | | bool testDiscardFlag( DiscardFlag flag ) const; | |
| | | | |
| skipping to change at line 128 | | skipping to change at line 135 | |
| | | | |
| #ifndef QT_NO_PRINTER | | #ifndef QT_NO_PRINTER | |
| void renderTo( QwtPlot *, QPrinter & ) const; | | void renderTo( QwtPlot *, QPrinter & ) const; | |
| #endif | | #endif | |
| | | | |
| void renderTo( QwtPlot *, QPaintDevice &p ) const; | | void renderTo( QwtPlot *, QPaintDevice &p ) const; | |
| | | | |
| virtual void render( QwtPlot *, | | virtual void render( QwtPlot *, | |
| QPainter *, const QRectF &rect ) const; | | QPainter *, const QRectF &rect ) const; | |
| | | | |
|
| virtual void renderLegendItem( const QwtPlot *, | | | |
| QPainter *, const QWidget *, const QRectF & ) const; | | | |
| | | | |
| virtual void renderTitle( const QwtPlot *, | | virtual void renderTitle( const QwtPlot *, | |
| QPainter *, const QRectF & ) const; | | QPainter *, const QRectF & ) const; | |
| | | | |
|
| | | virtual void renderFooter( const QwtPlot *, | |
| | | QPainter *, const QRectF & ) const; | |
| | | | |
| virtual void renderScale( const QwtPlot *, QPainter *, | | virtual void renderScale( const QwtPlot *, QPainter *, | |
| int axisId, int startDist, int endDist, | | int axisId, int startDist, int endDist, | |
| int baseDist, const QRectF & ) const; | | int baseDist, const QRectF & ) const; | |
| | | | |
| virtual void renderCanvas( const QwtPlot *, | | virtual void renderCanvas( const QwtPlot *, | |
| QPainter *, const QRectF &canvasRect, | | QPainter *, const QRectF &canvasRect, | |
| const QwtScaleMap* maps ) const; | | const QwtScaleMap* maps ) const; | |
| | | | |
| virtual void renderLegend( | | virtual void renderLegend( | |
| const QwtPlot *, QPainter *, const QRectF & ) const; | | const QwtPlot *, QPainter *, const QRectF & ) const; | |
| | | | |
|
| protected: | | bool exportTo( QwtPlot *, const QString &documentName, | |
| | | const QSizeF &sizeMM = QSizeF( 300, 200 ), int resolution = 85 ); | |
| | | | |
| | | private: | |
| void buildCanvasMaps( const QwtPlot *, | | void buildCanvasMaps( const QwtPlot *, | |
| const QRectF &, QwtScaleMap maps[] ) const; | | const QRectF &, QwtScaleMap maps[] ) const; | |
| | | | |
|
| | | bool updateCanvasMargins( QwtPlot *, | |
| | | const QRectF &, const QwtScaleMap maps[] ) const; | |
| | | | |
| private: | | private: | |
| class PrivateData; | | class PrivateData; | |
| PrivateData *d_data; | | PrivateData *d_data; | |
| }; | | }; | |
| | | | |
| Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::DiscardFlags ) | | Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::DiscardFlags ) | |
| Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::LayoutFlags ) | | Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRenderer::LayoutFlags ) | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 10 change blocks. |
| 14 lines changed or deleted | | 27 lines changed or added | |
|
| qwt_plot_rescaler.h | | qwt_plot_rescaler.h | |
| | | | |
| skipping to change at line 18 | | skipping to change at line 18 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_PLOT_RESCALER_H | | #ifndef QWT_PLOT_RESCALER_H | |
| #define QWT_PLOT_RESCALER_H 1 | | #define QWT_PLOT_RESCALER_H 1 | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include "qwt_interval.h" | | #include "qwt_interval.h" | |
| #include "qwt_plot.h" | | #include "qwt_plot.h" | |
| #include <qobject.h> | | #include <qobject.h> | |
| | | | |
|
| class QwtPlotCanvas; | | | |
| class QwtPlot; | | class QwtPlot; | |
| class QResizeEvent; | | class QResizeEvent; | |
| | | | |
| /*! | | /*! | |
| \brief QwtPlotRescaler takes care of fixed aspect ratios for plot scale
s | | \brief QwtPlotRescaler takes care of fixed aspect ratios for plot scale
s | |
| | | | |
|
| QwtPlotRescaler autoadjusts the axes of a QwtPlot according | | QwtPlotRescaler auto adjusts the axes of a QwtPlot according | |
| to fixed aspect ratios. | | to fixed aspect ratios. | |
| */ | | */ | |
| | | | |
| class QWT_EXPORT QwtPlotRescaler: public QObject | | class QWT_EXPORT QwtPlotRescaler: public QObject | |
| { | | { | |
| public: | | public: | |
| /*! | | /*! | |
| The rescale policy defines how to rescale the reference axis and | | The rescale policy defines how to rescale the reference axis and | |
| their depending axes. | | their depending axes. | |
| | | | |
| | | | |
| skipping to change at line 48 | | skipping to change at line 47 | |
| enum RescalePolicy | | enum RescalePolicy | |
| { | | { | |
| /*! | | /*! | |
| The interval of the reference axis remains unchanged, when the | | The interval of the reference axis remains unchanged, when the | |
| geometry of the canvas changes. All other axes | | geometry of the canvas changes. All other axes | |
| will be adjusted according to their aspect ratio. | | will be adjusted according to their aspect ratio. | |
| */ | | */ | |
| Fixed, | | Fixed, | |
| | | | |
| /*! | | /*! | |
|
| The interval of the reference axis will be shrinked/expanded, | | The interval of the reference axis will be shrunk/expanded, | |
| when the geometry of the canvas changes. All other axes | | when the geometry of the canvas changes. All other axes | |
| will be adjusted according to their aspect ratio. | | will be adjusted according to their aspect ratio. | |
| | | | |
| The interval, that is represented by one pixel is fixed. | | The interval, that is represented by one pixel is fixed. | |
| | | | |
| */ | | */ | |
| Expanding, | | Expanding, | |
| | | | |
| /*! | | /*! | |
| The intervals of the axes are calculated, so that all axes includ
e | | The intervals of the axes are calculated, so that all axes includ
e | |
| | | | |
| skipping to change at line 80 | | skipping to change at line 79 | |
| //! The upper limit of the scale is adjusted | | //! The upper limit of the scale is adjusted | |
| ExpandUp, | | ExpandUp, | |
| | | | |
| //! The lower limit of the scale is adjusted | | //! The lower limit of the scale is adjusted | |
| ExpandDown, | | ExpandDown, | |
| | | | |
| //! Both limits of the scale are adjusted | | //! Both limits of the scale are adjusted | |
| ExpandBoth | | ExpandBoth | |
| }; | | }; | |
| | | | |
|
| explicit QwtPlotRescaler( QwtPlotCanvas *, | | explicit QwtPlotRescaler( QWidget *canvas, | |
| int referenceAxis = QwtPlot::xBottom, | | int referenceAxis = QwtPlot::xBottom, | |
| RescalePolicy = Expanding ); | | RescalePolicy = Expanding ); | |
| | | | |
| virtual ~QwtPlotRescaler(); | | virtual ~QwtPlotRescaler(); | |
| | | | |
| void setEnabled( bool ); | | void setEnabled( bool ); | |
| bool isEnabled() const; | | bool isEnabled() const; | |
| | | | |
| void setRescalePolicy( RescalePolicy ); | | void setRescalePolicy( RescalePolicy ); | |
| RescalePolicy rescalePolicy() const; | | RescalePolicy rescalePolicy() const; | |
| | | | |
| skipping to change at line 106 | | skipping to change at line 105 | |
| void setReferenceAxis( int axis ); | | void setReferenceAxis( int axis ); | |
| int referenceAxis() const; | | int referenceAxis() const; | |
| | | | |
| void setAspectRatio( double ratio ); | | void setAspectRatio( double ratio ); | |
| void setAspectRatio( int axis, double ratio ); | | void setAspectRatio( int axis, double ratio ); | |
| double aspectRatio( int axis ) const; | | double aspectRatio( int axis ) const; | |
| | | | |
| void setIntervalHint( int axis, const QwtInterval& ); | | void setIntervalHint( int axis, const QwtInterval& ); | |
| QwtInterval intervalHint( int axis ) const; | | QwtInterval intervalHint( int axis ) const; | |
| | | | |
|
| QwtPlotCanvas *canvas(); | | QWidget *canvas(); | |
| const QwtPlotCanvas *canvas() const; | | const QWidget *canvas() const; | |
| | | | |
| QwtPlot *plot(); | | QwtPlot *plot(); | |
| const QwtPlot *plot() const; | | const QwtPlot *plot() const; | |
| | | | |
| virtual bool eventFilter( QObject *, QEvent * ); | | virtual bool eventFilter( QObject *, QEvent * ); | |
| | | | |
| void rescale() const; | | void rescale() const; | |
| | | | |
| protected: | | protected: | |
| virtual void canvasResizeEvent( QResizeEvent * ); | | virtual void canvasResizeEvent( QResizeEvent * ); | |
| | | | |
End of changes. 5 change blocks. |
| 6 lines changed or deleted | | 5 lines changed or added | |
|
| qwt_plot_seriesitem.h | | qwt_plot_seriesitem.h | |
| | | | |
| skipping to change at line 17 | | skipping to change at line 17 | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_PLOT_SERIES_ITEM_H | | #ifndef QWT_PLOT_SERIES_ITEM_H | |
| #define QWT_PLOT_SERIES_ITEM_H | | #define QWT_PLOT_SERIES_ITEM_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include "qwt_plot_item.h" | | #include "qwt_plot_item.h" | |
| #include "qwt_scale_div.h" | | #include "qwt_scale_div.h" | |
| #include "qwt_series_data.h" | | #include "qwt_series_data.h" | |
|
| | | #include "qwt_series_store.h" | |
| | | | |
| /*! | | /*! | |
| \brief Base class for plot items representing a series of samples | | \brief Base class for plot items representing a series of samples | |
| */ | | */ | |
|
| class QWT_EXPORT QwtPlotAbstractSeriesItem: public QwtPlotItem | | class QWT_EXPORT QwtPlotSeriesItem: public QwtPlotItem, | |
| | | public virtual QwtAbstractSeriesStore | |
| { | | { | |
| public: | | public: | |
|
| explicit QwtPlotAbstractSeriesItem( const QString &title = QString::nul | | explicit QwtPlotSeriesItem( const QString &title = QString::null ); | |
| l ); | | explicit QwtPlotSeriesItem( const QwtText &title ); | |
| explicit QwtPlotAbstractSeriesItem( const QwtText &title ); | | | |
| | | | |
|
| virtual ~QwtPlotAbstractSeriesItem(); | | virtual ~QwtPlotSeriesItem(); | |
| | | | |
| void setOrientation( Qt::Orientation ); | | void setOrientation( Qt::Orientation ); | |
| Qt::Orientation orientation() const; | | Qt::Orientation orientation() const; | |
| | | | |
| virtual void draw( QPainter *p, | | virtual void draw( QPainter *p, | |
| const QwtScaleMap &xMap, const QwtScaleMap &yMap, | | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |
| const QRectF & ) const; | | const QRectF & ) const; | |
| | | | |
| /*! | | /*! | |
| Draw a subset of the samples | | Draw a subset of the samples | |
| | | | |
| \param painter Painter | | \param painter Painter | |
| \param xMap Maps x-values into pixel coordinates. | | \param xMap Maps x-values into pixel coordinates. | |
| \param yMap Maps y-values into pixel coordinates. | | \param yMap Maps y-values into pixel coordinates. | |
|
| \param canvasRect Contents rect of the canvas | | \param canvasRect Contents rectangle of the canvas | |
| \param from Index of the first point to be painted | | \param from Index of the first point to be painted | |
| \param to Index of the last point to be painted. If to < 0 the | | \param to Index of the last point to be painted. If to < 0 the | |
| curve will be painted to its last point. | | curve will be painted to its last point. | |
| */ | | */ | |
| virtual void drawSeries( QPainter *painter, | | virtual void drawSeries( QPainter *painter, | |
| const QwtScaleMap &xMap, const QwtScaleMap &yMap, | | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |
| const QRectF &canvasRect, int from, int to ) const = 0; | | const QRectF &canvasRect, int from, int to ) const = 0; | |
| | | | |
|
| private: | | | |
| class PrivateData; | | | |
| PrivateData *d_data; | | | |
| }; | | | |
| | | | |
| /*! | | | |
| \brief Class template for plot items representing a series of samples | | | |
| */ | | | |
| template <typename T> | | | |
| class QwtPlotSeriesItem: public QwtPlotAbstractSeriesItem | | | |
| { | | | |
| public: | | | |
| /*! | | | |
| Constructor | | | |
| \param title Title of the series item | | | |
| */ | | | |
| explicit QwtPlotSeriesItem<T>( const QString &title = QString::null ); | | | |
| | | | |
| /*! | | | |
| Constructor | | | |
| \param title Title of the series item | | | |
| */ | | | |
| explicit QwtPlotSeriesItem<T>( const QwtText &title ); | | | |
| | | | |
| //! Destructor | | | |
| virtual ~QwtPlotSeriesItem<T>(); | | | |
| | | | |
| /*! | | | |
| Assign a series of samples | | | |
| | | | |
| \param data Data | | | |
| \warning The item takes ownership of the data object, deleting | | | |
| it when its not used anymore. | | | |
| */ | | | |
| void setData( QwtSeriesData<T> * ); | | | |
| | | | |
| //! \return the the curve data | | | |
| QwtSeriesData<T> *data(); | | | |
| | | | |
| //! \return the the curve data | | | |
| const QwtSeriesData<T> *data() const; | | | |
| | | | |
| /*! | | | |
| Return the size of the data arrays | | | |
| \sa setData() | | | |
| */ | | | |
| size_t dataSize() const; | | | |
| | | | |
| /*! | | | |
| \param index Index | | | |
| \return Sample at position index | | | |
| */ | | | |
| T sample( int index ) const; | | | |
| | | | |
| /*! | | | |
| \return Bounding rectangle of the data. | | | |
| If there is no bounding rect, like for empty data the rectangle is in | | | |
| valid. | | | |
| | | | |
| \sa QwtSeriesData<T>::boundingRect(), QRectF::isValid() | | | |
| */ | | | |
| virtual QRectF boundingRect() const; | | virtual QRectF boundingRect() const; | |
| | | | |
|
| /*! | | virtual void updateScaleDiv( | |
| Update the rect of interest according to the current scale ranges | | const QwtScaleDiv &, const QwtScaleDiv & ); | |
| | | | |
| \param xScaleDiv Scale division of the x-axis | | | |
| \param yScaleDiv Scale division of the y-axis | | | |
| | | | |
| \sa QwtSeriesData<T>::setRectOfInterest() | | | |
| */ | | | |
| virtual void updateScaleDiv( const QwtScaleDiv &, | | | |
| const QwtScaleDiv & ); | | | |
| | | | |
| protected: | | protected: | |
|
| //! Series | | virtual void dataChanged(); | |
| QwtSeriesData<T> *d_series; | | | |
| }; | | | |
| | | | |
| template <typename T> | | | |
| QwtPlotSeriesItem<T>::QwtPlotSeriesItem( const QString &title ): | | | |
| QwtPlotAbstractSeriesItem( QwtText( title ) ), | | | |
| d_series( NULL ) | | | |
| { | | | |
| } | | | |
| | | | |
| template <typename T> | | | |
| QwtPlotSeriesItem<T>::QwtPlotSeriesItem( const QwtText &title ): | | | |
| QwtPlotAbstractSeriesItem( title ), | | | |
| d_series( NULL ) | | | |
| { | | | |
| } | | | |
| | | | |
| template <typename T> | | | |
| QwtPlotSeriesItem<T>::~QwtPlotSeriesItem() | | | |
| { | | | |
| delete d_series; | | | |
| } | | | |
| | | | |
| template <typename T> | | | |
| inline QwtSeriesData<T> *QwtPlotSeriesItem<T>::data() | | | |
| { | | | |
| return d_series; | | | |
| } | | | |
| | | | |
| template <typename T> | | | |
| inline const QwtSeriesData<T> *QwtPlotSeriesItem<T>::data() const | | | |
| { | | | |
| return d_series; | | | |
| } | | | |
| | | | |
|
| template <typename T> | | private: | |
| inline T QwtPlotSeriesItem<T>::sample( int index ) const | | class PrivateData; | |
| { | | PrivateData *d_data; | |
| return d_series ? d_series->sample( index ) : T(); | | }; | |
| } | | | |
| | | | |
| template <typename T> | | | |
| void QwtPlotSeriesItem<T>::setData( QwtSeriesData<T> *data ) | | | |
| { | | | |
| if ( d_series != data ) | | | |
| { | | | |
| delete d_series; | | | |
| d_series = data; | | | |
| itemChanged(); | | | |
| } | | | |
| } | | | |
| | | | |
| template <typename T> | | | |
| size_t QwtPlotSeriesItem<T>::dataSize() const | | | |
| { | | | |
| if ( d_series == NULL ) | | | |
| return 0; | | | |
| | | | |
| return d_series->size(); | | | |
| } | | | |
| | | | |
| template <typename T> | | | |
| QRectF QwtPlotSeriesItem<T>::boundingRect() const | | | |
| { | | | |
| if ( d_series == NULL ) | | | |
| return QRectF( 1.0, 1.0, -2.0, -2.0 ); // invalid | | | |
| | | | |
| return d_series->boundingRect(); | | | |
| } | | | |
| | | | |
| template <typename T> | | | |
| void QwtPlotSeriesItem<T>::updateScaleDiv( | | | |
| const QwtScaleDiv &xScaleDiv, const QwtScaleDiv &yScaleDiv ) | | | |
| { | | | |
| if ( d_series ) | | | |
| { | | | |
| const QRectF rect = QRectF( | | | |
| xScaleDiv.lowerBound(), yScaleDiv.lowerBound(), | | | |
| xScaleDiv.range(), yScaleDiv.range() ); | | | |
| | | | |
| d_series->setRectOfInterest( rect ); | | | |
| } | | | |
| } | | | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 9 change blocks. |
| 160 lines changed or deleted | | 14 lines changed or added | |
|
| qwt_plot_spectrogram.h | | qwt_plot_spectrogram.h | |
| | | | |
| skipping to change at line 23 | | skipping to change at line 23 | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include "qwt_raster_data.h" | | #include "qwt_raster_data.h" | |
| #include "qwt_plot_rasteritem.h" | | #include "qwt_plot_rasteritem.h" | |
| #include <qlist.h> | | #include <qlist.h> | |
| | | | |
| class QwtColorMap; | | class QwtColorMap; | |
| | | | |
| /*! | | /*! | |
| \brief A plot item, which displays a spectrogram | | \brief A plot item, which displays a spectrogram | |
| | | | |
|
| A spectrogram displays threedimenional data, where the 3rd dimension | | A spectrogram displays 3-dimensional data, where the 3rd dimension | |
| ( the intensity ) is displayed using colors. The colors are calculated | | ( the intensity ) is displayed using colors. The colors are calculated | |
| from the values using a color map. | | from the values using a color map. | |
| | | | |
|
| | | On multi-core systems the performance of the image composition | |
| | | can often be improved by dividing the area into tiles - each of them | |
| | | rendered in a different thread ( see QwtPlotItem::setRenderThreadCount() | |
| | | ). | |
| | | | |
| In ContourMode contour lines are painted for the contour levels. | | In ContourMode contour lines are painted for the contour levels. | |
| | | | |
| \image html spectrogram3.png | | \image html spectrogram3.png | |
| | | | |
|
| \sa QwtRasterData, QwtColorMap | | \sa QwtRasterData, QwtColorMap, QwtPlotItem::setRenderThreadCount() | |
| */ | | */ | |
| | | | |
| class QWT_EXPORT QwtPlotSpectrogram: public QwtPlotRasterItem | | class QWT_EXPORT QwtPlotSpectrogram: public QwtPlotRasterItem | |
| { | | { | |
| public: | | public: | |
| /*! | | /*! | |
| The display mode controls how the raster data will be represented. | | The display mode controls how the raster data will be represented. | |
| \sa setDisplayMode(), testDisplayMode() | | \sa setDisplayMode(), testDisplayMode() | |
| */ | | */ | |
| | | | |
| | | | |
| skipping to change at line 57 | | skipping to change at line 61 | |
| //! The data is displayed using contour lines | | //! The data is displayed using contour lines | |
| ContourMode = 0x02 | | ContourMode = 0x02 | |
| }; | | }; | |
| | | | |
| //! Display modes | | //! Display modes | |
| typedef QFlags<DisplayMode> DisplayModes; | | typedef QFlags<DisplayMode> DisplayModes; | |
| | | | |
| explicit QwtPlotSpectrogram( const QString &title = QString::null ); | | explicit QwtPlotSpectrogram( const QString &title = QString::null ); | |
| virtual ~QwtPlotSpectrogram(); | | virtual ~QwtPlotSpectrogram(); | |
| | | | |
|
| void setRenderThreadCount( uint numThreads ); | | | |
| uint renderThreadCount() const; | | | |
| | | | |
| void setDisplayMode( DisplayMode, bool on = true ); | | void setDisplayMode( DisplayMode, bool on = true ); | |
| bool testDisplayMode( DisplayMode ) const; | | bool testDisplayMode( DisplayMode ) const; | |
| | | | |
| void setData( QwtRasterData *data ); | | void setData( QwtRasterData *data ); | |
| const QwtRasterData *data() const; | | const QwtRasterData *data() const; | |
| QwtRasterData *data(); | | QwtRasterData *data(); | |
| | | | |
| void setColorMap( QwtColorMap * ); | | void setColorMap( QwtColorMap * ); | |
| const QwtColorMap *colorMap() const; | | const QwtColorMap *colorMap() const; | |
| | | | |
| virtual QwtInterval interval(Qt::Axis) const; | | virtual QwtInterval interval(Qt::Axis) const; | |
| virtual QRectF pixelHint( const QRectF & ) const; | | virtual QRectF pixelHint( const QRectF & ) const; | |
| | | | |
|
| | | void setDefaultContourPen( const QColor &, | |
| | | qreal width = 0.0, Qt::PenStyle = Qt::SolidLine ); | |
| void setDefaultContourPen( const QPen & ); | | void setDefaultContourPen( const QPen & ); | |
| QPen defaultContourPen() const; | | QPen defaultContourPen() const; | |
| | | | |
| virtual QPen contourPen( double level ) const; | | virtual QPen contourPen( double level ) const; | |
| | | | |
| void setConrecFlag( QwtRasterData::ConrecFlag, bool on ); | | void setConrecFlag( QwtRasterData::ConrecFlag, bool on ); | |
| bool testConrecFlag( QwtRasterData::ConrecFlag ) const; | | bool testConrecFlag( QwtRasterData::ConrecFlag ) const; | |
| | | | |
| void setContourLevels( const QList<double> & ); | | void setContourLevels( const QList<double> & ); | |
| QList<double> contourLevels() const; | | QList<double> contourLevels() const; | |
| | | | |
End of changes. 5 change blocks. |
| 5 lines changed or deleted | | 9 lines changed or added | |
|
| qwt_plot_zoomer.h | | qwt_plot_zoomer.h | |
| | | | |
| skipping to change at line 20 | | skipping to change at line 20 | |
| #ifndef QWT_PLOT_ZOOMER_H | | #ifndef QWT_PLOT_ZOOMER_H | |
| #define QWT_PLOT_ZOOMER_H | | #define QWT_PLOT_ZOOMER_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include "qwt_plot_picker.h" | | #include "qwt_plot_picker.h" | |
| #include <qstack.h> | | #include <qstack.h> | |
| | | | |
| /*! | | /*! | |
| \brief QwtPlotZoomer provides stacked zooming for a plot widget | | \brief QwtPlotZoomer provides stacked zooming for a plot widget | |
| | | | |
|
| QwtPlotZoomer offers rubberband selections on the plot canvas, | | QwtPlotZoomer selects rectangles from user inputs ( mouse or keyboard ) | |
| translating the selected rectangles into plot coordinates and | | translates them into plot coordinates and adjusts the axes to them. | |
| adjusting the axes to them. Zooming can repeated as often as | | The selection is supported by a rubber band and optionally by displaying | |
| possible, limited only by maxStackDepth() or minZoomSize(). | | the coordinates of the current mouse position. | |
| Each rectangle is pushed on a stack. | | | |
| | | Zooming can be repeated as often as possible, limited only by | |
| Zoom rectangles can be selected depending on selectionFlags() using the | | maxStackDepth() or minZoomSize(). Each rectangle is pushed on a stack. | |
| mouse or keyboard (QwtEventPattern, QwtPickerMachine). | | | |
| QwtEventPattern::MouseSelect3,QwtEventPattern::KeyUndo, | | The default setting how to select rectangles is | |
| or QwtEventPattern::MouseSelect6,QwtEventPattern::KeyRedo | | a QwtPickerDragRectMachine with the following bindings: | |
| walk up and down the zoom stack. | | | |
| QwtEventPattern::MouseSelect2 or QwtEventPattern::KeyHome unzoom to | | - QwtEventPattern::MouseSelect1\n | |
| the initial size. | | The first point of the zoom rectangle is selected by a mouse press, | |
| | | the second point from the position, where the mouse is released. | |
| | | | |
| | | - QwtEventPattern::KeySelect1\n | |
| | | The first key press selects the first, the second key press | |
| | | selects the second point. | |
| | | | |
| | | - QwtEventPattern::KeyAbort\n | |
| | | Discard the selection in the state, where the first point | |
| | | is selected. | |
| | | | |
| | | To traverse the zoom stack the following bindings are used: | |
| | | | |
| | | - QwtEventPattern::MouseSelect3, QwtEventPattern::KeyUndo\n | |
| | | Zoom out one position on the zoom stack | |
| | | | |
| | | - QwtEventPattern::MouseSelect6, QwtEventPattern::KeyRedo\n | |
| | | Zoom in one position on the zoom stack | |
| | | | |
| | | - QwtEventPattern::MouseSelect2, QwtEventPattern::KeyHome\n | |
| | | Zoom to the zoom base | |
| | | | |
| | | The setKeyPattern() and setMousePattern() functions can be used | |
| | | to configure the zoomer actions. The following example | |
| | | shows, how to configure the 'I' and 'O' keys for zooming in and out | |
| | | one position on the zoom stack. The "Home" key is used to | |
| | | "unzoom" the plot. | |
| | | | |
| | | \code | |
| | | zoomer = new QwtPlotZoomer( plot ); | |
| | | zoomer->setKeyPattern( QwtEventPattern::KeyRedo, Qt::Key_I, Qt::ShiftMod | |
| | | ifier ); | |
| | | zoomer->setKeyPattern( QwtEventPattern::KeyUndo, Qt::Key_O, Qt::ShiftMod | |
| | | ifier ); | |
| | | zoomer->setKeyPattern( QwtEventPattern::KeyHome, Qt::Key_Home ); | |
| | | \endcode | |
| | | | |
| QwtPlotZoomer is tailored for plots with one x and y axis, but it is | | QwtPlotZoomer is tailored for plots with one x and y axis, but it is | |
|
| allowed to attach a second QwtPlotZoomer for the other axes. | | allowed to attach a second QwtPlotZoomer ( without rubber band and tracke | |
| | | r ) | |
| | | for the other axes. | |
| | | | |
| \note The realtime example includes an derived zoomer class that adds | | \note The realtime example includes an derived zoomer class that adds | |
| scrollbars to the plot canvas. | | scrollbars to the plot canvas. | |
|
| | | | |
| | | \sa QwtPlotPanner, QwtPlotMagnifier | |
| */ | | */ | |
| | | | |
| class QWT_EXPORT QwtPlotZoomer: public QwtPlotPicker | | class QWT_EXPORT QwtPlotZoomer: public QwtPlotPicker | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| public: | | public: | |
|
| explicit QwtPlotZoomer( QwtPlotCanvas *, bool doReplot = true ); | | explicit QwtPlotZoomer( QWidget *, bool doReplot = true ); | |
| explicit QwtPlotZoomer( int xAxis, int yAxis, | | explicit QwtPlotZoomer( int xAxis, int yAxis, | |
|
| QwtPlotCanvas *, bool doReplot = true ); | | QWidget *, bool doReplot = true ); | |
| | | | |
| virtual ~QwtPlotZoomer(); | | virtual ~QwtPlotZoomer(); | |
| | | | |
| virtual void setZoomBase( bool doReplot = true ); | | virtual void setZoomBase( bool doReplot = true ); | |
| virtual void setZoomBase( const QRectF & ); | | virtual void setZoomBase( const QRectF & ); | |
| | | | |
| QRectF zoomBase() const; | | QRectF zoomBase() const; | |
| QRectF zoomRect() const; | | QRectF zoomRect() const; | |
| | | | |
| virtual void setAxis( int xAxis, int yAxis ); | | virtual void setAxis( int xAxis, int yAxis ); | |
| | | | |
End of changes. 5 change blocks. |
| 16 lines changed or deleted | | 55 lines changed or added | |
|
| qwt_point_3d.h | | qwt_point_3d.h | |
| | | | |
| skipping to change at line 105 | | skipping to change at line 105 | |
| and a z coordinate of 0. | | and a z coordinate of 0. | |
| */ | | */ | |
| inline QwtPoint3D::QwtPoint3D( const QPointF &other ): | | inline QwtPoint3D::QwtPoint3D( const QPointF &other ): | |
| d_x( other.x() ), | | d_x( other.x() ), | |
| d_y( other.y() ), | | d_y( other.y() ), | |
| d_z( 0.0 ) | | d_z( 0.0 ) | |
| { | | { | |
| } | | } | |
| | | | |
| /*! | | /*! | |
|
| Returns true if the point is null; otherwise returns false. | | \return True if the point is null; otherwise returns false. | |
| | | | |
| A point is considered to be null if x, y and z-coordinates | | A point is considered to be null if x, y and z-coordinates | |
| are equal to zero. | | are equal to zero. | |
| */ | | */ | |
| inline bool QwtPoint3D::isNull() const | | inline bool QwtPoint3D::isNull() const | |
| { | | { | |
| return d_x == 0.0 && d_y == 0.0 && d_z == 0.0; | | return d_x == 0.0 && d_y == 0.0 && d_z == 0.0; | |
| } | | } | |
| | | | |
|
| //! Returns the x-coordinate of the point. | | //! \return The x-coordinate of the point. | |
| inline double QwtPoint3D::x() const | | inline double QwtPoint3D::x() const | |
| { | | { | |
| return d_x; | | return d_x; | |
| } | | } | |
| | | | |
|
| //! Returns the y-coordinate of the point. | | //! \return The y-coordinate of the point. | |
| inline double QwtPoint3D::y() const | | inline double QwtPoint3D::y() const | |
| { | | { | |
| return d_y; | | return d_y; | |
| } | | } | |
| | | | |
|
| //! Returns the z-coordinate of the point. | | //! \return The z-coordinate of the point. | |
| inline double QwtPoint3D::z() const | | inline double QwtPoint3D::z() const | |
| { | | { | |
| return d_z; | | return d_z; | |
| } | | } | |
| | | | |
|
| //! Returns a reference to the x-coordinate of the point. | | //! \return A reference to the x-coordinate of the point. | |
| inline double &QwtPoint3D::rx() | | inline double &QwtPoint3D::rx() | |
| { | | { | |
| return d_x; | | return d_x; | |
| } | | } | |
| | | | |
|
| //! Returns a reference to the y-coordinate of the point. | | //! \return A reference to the y-coordinate of the point. | |
| inline double &QwtPoint3D::ry() | | inline double &QwtPoint3D::ry() | |
| { | | { | |
| return d_y; | | return d_y; | |
| } | | } | |
| | | | |
|
| //! Returns a reference to the z-coordinate of the point. | | //! \return A reference to the z-coordinate of the point. | |
| inline double &QwtPoint3D::rz() | | inline double &QwtPoint3D::rz() | |
| { | | { | |
| return d_z; | | return d_z; | |
| } | | } | |
| | | | |
| //! Sets the x-coordinate of the point to the value specified by x. | | //! Sets the x-coordinate of the point to the value specified by x. | |
| inline void QwtPoint3D::setX( double x ) | | inline void QwtPoint3D::setX( double x ) | |
| { | | { | |
| d_x = x; | | d_x = x; | |
| } | | } | |
| | | | |
| skipping to change at line 170 | | skipping to change at line 170 | |
| d_y = y; | | d_y = y; | |
| } | | } | |
| | | | |
| //! Sets the z-coordinate of the point to the value specified by z. | | //! Sets the z-coordinate of the point to the value specified by z. | |
| inline void QwtPoint3D::setZ( double z ) | | inline void QwtPoint3D::setZ( double z ) | |
| { | | { | |
| d_z = z; | | d_z = z; | |
| } | | } | |
| | | | |
| /*! | | /*! | |
|
| Rounds 2D point, where the z coordinate is dropped. | | \return 2D point, where the z coordinate is dropped. | |
| */ | | */ | |
| inline QPointF QwtPoint3D::toPoint() const | | inline QPointF QwtPoint3D::toPoint() const | |
| { | | { | |
| return QPointF( d_x, d_y ); | | return QPointF( d_x, d_y ); | |
| } | | } | |
| | | | |
|
| //! Returns true if this point and other are equal; otherwise returns false
. | | //! \return True, if this point and other are equal; otherwise returns fals
e. | |
| inline bool QwtPoint3D::operator==( const QwtPoint3D &other ) const | | inline bool QwtPoint3D::operator==( const QwtPoint3D &other ) const | |
| { | | { | |
| return ( d_x == other.d_x ) && ( d_y == other.d_y ) && ( d_z == other.d
_z ); | | return ( d_x == other.d_x ) && ( d_y == other.d_y ) && ( d_z == other.d
_z ); | |
| } | | } | |
| | | | |
|
| //! Returns true if this rect and other are different; otherwise returns fa
lse. | | //! \return True if this rect and other are different; otherwise returns fa
lse. | |
| inline bool QwtPoint3D::operator!=( const QwtPoint3D &other ) const | | inline bool QwtPoint3D::operator!=( const QwtPoint3D &other ) const | |
| { | | { | |
| return !operator==( other ); | | return !operator==( other ); | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 10 change blocks. |
| 10 lines changed or deleted | | 10 lines changed or added | |
|
| qwt_round_scale_draw.h | | qwt_round_scale_draw.h | |
| | | | |
| skipping to change at line 17 | | skipping to change at line 17 | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_ROUND_SCALE_DRAW_H | | #ifndef QWT_ROUND_SCALE_DRAW_H | |
| #define QWT_ROUND_SCALE_DRAW_H | | #define QWT_ROUND_SCALE_DRAW_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include "qwt_abstract_scale_draw.h" | | #include "qwt_abstract_scale_draw.h" | |
| #include <qpoint.h> | | #include <qpoint.h> | |
| | | | |
|
| class QPen; | | | |
| | | | |
| /*! | | /*! | |
| \brief A class for drawing round scales | | \brief A class for drawing round scales | |
| | | | |
| QwtRoundScaleDraw can be used to draw round scales. | | QwtRoundScaleDraw can be used to draw round scales. | |
|
| The circle segment can be adjusted by QwtRoundScaleDraw::setAngleRange(). | | The circle segment can be adjusted by setAngleRange(). | |
| The geometry of the scale can be specified with | | The geometry of the scale can be specified with | |
|
| QwtRoundScaleDraw::moveCenter() and QwtRoundScaleDraw::setRadius(). | | moveCenter() and setRadius(). | |
| | | | |
| After a scale division has been specified as a QwtScaleDiv object | | After a scale division has been specified as a QwtScaleDiv object | |
| using QwtAbstractScaleDraw::setScaleDiv(const QwtScaleDiv &s), | | using QwtAbstractScaleDraw::setScaleDiv(const QwtScaleDiv &s), | |
| the scale can be drawn with the QwtAbstractScaleDraw::draw() member. | | the scale can be drawn with the QwtAbstractScaleDraw::draw() member. | |
| */ | | */ | |
| | | | |
| class QWT_EXPORT QwtRoundScaleDraw: public QwtAbstractScaleDraw | | class QWT_EXPORT QwtRoundScaleDraw: public QwtAbstractScaleDraw | |
| { | | { | |
| public: | | public: | |
| QwtRoundScaleDraw(); | | QwtRoundScaleDraw(); | |
| virtual ~QwtRoundScaleDraw(); | | virtual ~QwtRoundScaleDraw(); | |
| | | | |
|
| void setRadius( int radius ); | | void setRadius( double radius ); | |
| int radius() const; | | double radius() const; | |
| | | | |
| void moveCenter( double x, double y ); | | void moveCenter( double x, double y ); | |
| void moveCenter( const QPointF & ); | | void moveCenter( const QPointF & ); | |
| QPointF center() const; | | QPointF center() const; | |
| | | | |
| void setAngleRange( double angle1, double angle2 ); | | void setAngleRange( double angle1, double angle2 ); | |
| | | | |
| virtual double extent( const QFont & ) const; | | virtual double extent( const QFont & ) const; | |
| | | | |
| protected: | | protected: | |
|
| virtual void drawTick( QPainter *p, double val, double len ) const; | | virtual void drawTick( QPainter *, double val, double len ) const; | |
| virtual void drawBackbone( QPainter *p ) const; | | virtual void drawBackbone( QPainter * ) const; | |
| virtual void drawLabel( QPainter *p, double val ) const; | | virtual void drawLabel( QPainter *, double val ) const; | |
| | | | |
| private: | | private: | |
| QwtRoundScaleDraw( const QwtRoundScaleDraw & ); | | QwtRoundScaleDraw( const QwtRoundScaleDraw & ); | |
| QwtRoundScaleDraw &operator=( const QwtRoundScaleDraw &other ); | | QwtRoundScaleDraw &operator=( const QwtRoundScaleDraw &other ); | |
| | | | |
| class PrivateData; | | class PrivateData; | |
| PrivateData *d_data; | | PrivateData *d_data; | |
| }; | | }; | |
| | | | |
| //! Move the center of the scale draw, leaving the radius unchanged | | //! Move the center of the scale draw, leaving the radius unchanged | |
| | | | |
End of changes. 5 change blocks. |
| 9 lines changed or deleted | | 7 lines changed or added | |
|
| qwt_scale_div.h | | qwt_scale_div.h | |
| | | | |
| skipping to change at line 17 | | skipping to change at line 17 | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_SCALE_DIV_H | | #ifndef QWT_SCALE_DIV_H | |
| #define QWT_SCALE_DIV_H | | #define QWT_SCALE_DIV_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include "qwt_interval.h" | | #include "qwt_interval.h" | |
| #include <qlist.h> | | #include <qlist.h> | |
| | | | |
|
| class QwtInterval; | | #ifndef QT_NO_DEBUG_STREAM | |
| | | #include <qdebug.h> | |
| | | #endif | |
| | | | |
| /*! | | /*! | |
| \brief A class representing a scale division | | \brief A class representing a scale division | |
| | | | |
|
| A scale division consists of its limits and 3 list | | A Qwt scale is defined by its boundaries and 3 list | |
| of tick values qualified as major, medium and minor ticks. | | for the positions of the major, medium and minor ticks. | |
| | | | |
| | | The upperLimit() might be smaller than the lowerLimit() | |
| | | to indicate inverted scales. | |
| | | | |
|
| In most cases scale divisions are calculated by a QwtScaleEngine. | | Scale divisions can be calculated from a QwtScaleEngine. | |
| | | | |
|
| \sa subDivideInto(), subDivide() | | \sa QwtScaleEngine::divideScale(), QwtPlot::setAxisScaleDiv(), | |
| | | QwtAbstractSlider::setScaleDiv() | |
| */ | | */ | |
| | | | |
| class QWT_EXPORT QwtScaleDiv | | class QWT_EXPORT QwtScaleDiv | |
| { | | { | |
| public: | | public: | |
| //! Scale tick types | | //! Scale tick types | |
| enum TickType | | enum TickType | |
| { | | { | |
| //! No ticks | | //! No ticks | |
| NoTick = -1, | | NoTick = -1, | |
| | | | |
| skipping to change at line 52 | | skipping to change at line 58 | |
| //! Medium ticks | | //! Medium ticks | |
| MediumTick, | | MediumTick, | |
| | | | |
| //! Major ticks | | //! Major ticks | |
| MajorTick, | | MajorTick, | |
| | | | |
| //! Number of valid tick types | | //! Number of valid tick types | |
| NTickTypes | | NTickTypes | |
| }; | | }; | |
| | | | |
|
| explicit QwtScaleDiv(); | | explicit QwtScaleDiv( double lowerBound = 0.0, | |
| | | double upperBound = 0.0 ); | |
| | | | |
| explicit QwtScaleDiv( const QwtInterval &, QList<double>[NTickTypes] ); | | explicit QwtScaleDiv( const QwtInterval &, QList<double>[NTickTypes] ); | |
|
| explicit QwtScaleDiv( | | | |
| double lowerBound, double upperBound, QList<double>[NTickTypes] ); | | | |
| | | | |
|
| bool operator==( const QwtScaleDiv &s ) const; | | explicit QwtScaleDiv( double lowerBound, double upperBound, | |
| bool operator!=( const QwtScaleDiv &s ) const; | | QList<double>[NTickTypes] ); | |
| | | | |
| | | explicit QwtScaleDiv( double lowerBound, double upperBound, | |
| | | const QList<double> &minorTicks, const QList<double> &mediumTicks, | |
| | | const QList<double> &majorTicks ); | |
| | | | |
| | | bool operator==( const QwtScaleDiv & ) const; | |
| | | bool operator!=( const QwtScaleDiv & ) const; | |
| | | | |
| void setInterval( double lowerBound, double upperBound ); | | void setInterval( double lowerBound, double upperBound ); | |
| void setInterval( const QwtInterval & ); | | void setInterval( const QwtInterval & ); | |
| QwtInterval interval() const; | | QwtInterval interval() const; | |
| | | | |
|
| | | void setLowerBound( double ); | |
| double lowerBound() const; | | double lowerBound() const; | |
|
| | | | |
| | | void setUpperBound( double ); | |
| double upperBound() const; | | double upperBound() const; | |
|
| | | | |
| double range() const; | | double range() const; | |
| | | | |
|
| bool contains( double v ) const; | | bool contains( double value ) const; | |
| | | | |
|
| void setTicks( int type, const QList<double> & ); | | void setTicks( int tickType, const QList<double> & ); | |
| const QList<double> &ticks( int type ) const; | | QList<double> ticks( int tickType ) const; | |
| | | | |
|
| void invalidate(); | | bool isEmpty() const; | |
| bool isValid() const; | | bool isIncreasing() const; | |
| | | | |
| void invert(); | | void invert(); | |
|
| | | QwtScaleDiv inverted() const; | |
| | | | |
| | | QwtScaleDiv bounded( double lowerBound, double upperBound ) const; | |
| | | | |
| private: | | private: | |
| double d_lowerBound; | | double d_lowerBound; | |
| double d_upperBound; | | double d_upperBound; | |
| QList<double> d_ticks[NTickTypes]; | | QList<double> d_ticks[NTickTypes]; | |
|
| | | | |
| bool d_isValid; | | | |
| }; | | }; | |
| | | | |
|
| Q_DECLARE_TYPEINFO(QwtScaleDiv, Q_MOVABLE_TYPE); | | Q_DECLARE_TYPEINFO( QwtScaleDiv, Q_MOVABLE_TYPE ); | |
| | | | |
| /*! | | | |
| Change the interval | | | |
| \param lowerBound lower bound | | | |
| \param upperBound upper bound | | | |
| */ | | | |
| inline void QwtScaleDiv::setInterval( double lowerBound, double upperBound | | | |
| ) | | | |
| { | | | |
| d_lowerBound = lowerBound; | | | |
| d_upperBound = upperBound; | | | |
| } | | | |
| | | | |
| /*! | | | |
| \return lowerBound -> upperBound | | | |
| */ | | | |
| inline QwtInterval QwtScaleDiv::interval() const | | | |
| { | | | |
| return QwtInterval( d_lowerBound, d_upperBound ); | | | |
| } | | | |
| | | | |
| /*! | | | |
| \return lower bound | | | |
| \sa upperBound() | | | |
| */ | | | |
| inline double QwtScaleDiv::lowerBound() const | | | |
| { | | | |
| return d_lowerBound; | | | |
| } | | | |
| | | | |
|
| /*! | | #ifndef QT_NO_DEBUG_STREAM | |
| \return upper bound | | QWT_EXPORT QDebug operator<<( QDebug, const QwtScaleDiv & ); | |
| \sa lowerBound() | | #endif | |
| */ | | | |
| inline double QwtScaleDiv::upperBound() const | | | |
| { | | | |
| return d_upperBound; | | | |
| } | | | |
| | | | |
|
| /*! | | | |
| \return upperBound() - lowerBound() | | | |
| */ | | | |
| inline double QwtScaleDiv::range() const | | | |
| { | | | |
| return d_upperBound - d_lowerBound; | | | |
| } | | | |
| #endif | | #endif | |
| | | | |
End of changes. 18 change blocks. |
| 62 lines changed or deleted | | 39 lines changed or added | |
|
| qwt_scale_engine.h | | qwt_scale_engine.h | |
| | | | |
| skipping to change at line 17 | | skipping to change at line 17 | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_SCALE_ENGINE_H | | #ifndef QWT_SCALE_ENGINE_H | |
| #define QWT_SCALE_ENGINE_H | | #define QWT_SCALE_ENGINE_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include "qwt_scale_div.h" | | #include "qwt_scale_div.h" | |
| #include "qwt_interval.h" | | #include "qwt_interval.h" | |
| | | | |
|
| class QwtScaleTransformation; | | class QwtTransform; | |
| | | | |
| /*! | | /*! | |
| \brief Arithmetic including a tolerance | | \brief Arithmetic including a tolerance | |
| */ | | */ | |
| class QWT_EXPORT QwtScaleArithmetic | | class QWT_EXPORT QwtScaleArithmetic | |
| { | | { | |
| public: | | public: | |
| static double ceilEps( double value, double intervalSize ); | | static double ceilEps( double value, double intervalSize ); | |
| static double floorEps( double value, double intervalSize ); | | static double floorEps( double value, double intervalSize ); | |
| | | | |
| static double divideEps( double interval, double steps ); | | static double divideEps( double interval, double steps ); | |
| | | | |
|
| static double ceil125( double x ); | | static double divideInterval( double interval, | |
| static double floor125( double x ); | | int numSteps, uint base ); | |
| }; | | }; | |
| | | | |
| /*! | | /*! | |
| \brief Base class for scale engines. | | \brief Base class for scale engines. | |
| | | | |
| A scale engine tries to find "reasonable" ranges and step sizes | | A scale engine tries to find "reasonable" ranges and step sizes | |
| for scales. | | for scales. | |
| | | | |
| The layout of the scale can be varied with setAttribute(). | | The layout of the scale can be varied with setAttribute(). | |
| | | | |
|
| Qwt offers implementations for logarithmic (log10) | | Qwt offers implementations for logarithmic and linear scales. | |
| and linear scales. Contributions for other types of scale engines | | | |
| (date/time, log2 ... ) are welcome. | | | |
| */ | | */ | |
| | | | |
| class QWT_EXPORT QwtScaleEngine | | class QWT_EXPORT QwtScaleEngine | |
| { | | { | |
| public: | | public: | |
| /*! | | /*! | |
| Layout attributes | | Layout attributes | |
| \sa setAttribute(), testAttribute(), reference(), | | \sa setAttribute(), testAttribute(), reference(), | |
| lowerMargin(), upperMargin() | | lowerMargin(), upperMargin() | |
| */ | | */ | |
| | | | |
| skipping to change at line 83 | | skipping to change at line 81 | |
| */ | | */ | |
| Floating = 0x04, | | Floating = 0x04, | |
| | | | |
| //! Turn the scale upside down. | | //! Turn the scale upside down. | |
| Inverted = 0x08 | | Inverted = 0x08 | |
| }; | | }; | |
| | | | |
| //! Layout attributes | | //! Layout attributes | |
| typedef QFlags<Attribute> Attributes; | | typedef QFlags<Attribute> Attributes; | |
| | | | |
|
| explicit QwtScaleEngine(); | | explicit QwtScaleEngine( uint base = 10 ); | |
| virtual ~QwtScaleEngine(); | | virtual ~QwtScaleEngine(); | |
| | | | |
|
| | | void setBase( uint base ); | |
| | | uint base() const; | |
| | | | |
| void setAttribute( Attribute, bool on = true ); | | void setAttribute( Attribute, bool on = true ); | |
| bool testAttribute( Attribute ) const; | | bool testAttribute( Attribute ) const; | |
| | | | |
| void setAttributes( Attributes ); | | void setAttributes( Attributes ); | |
| Attributes attributes() const; | | Attributes attributes() const; | |
| | | | |
| void setReference( double reference ); | | void setReference( double reference ); | |
| double reference() const; | | double reference() const; | |
| | | | |
| void setMargins( double lower, double upper ); | | void setMargins( double lower, double upper ); | |
| | | | |
| skipping to change at line 115 | | skipping to change at line 116 | |
| \param stepSize Step size (Return value) | | \param stepSize Step size (Return value) | |
| */ | | */ | |
| virtual void autoScale( int maxNumSteps, | | virtual void autoScale( int maxNumSteps, | |
| double &x1, double &x2, double &stepSize ) const = 0; | | double &x1, double &x2, double &stepSize ) const = 0; | |
| | | | |
| /*! | | /*! | |
| \brief Calculate a scale division | | \brief Calculate a scale division | |
| | | | |
| \param x1 First interval limit | | \param x1 First interval limit | |
| \param x2 Second interval limit | | \param x2 Second interval limit | |
|
| \param maxMajSteps Maximum for the number of major steps | | \param maxMajorSteps Maximum for the number of major steps | |
| \param maxMinSteps Maximum number of minor steps | | \param maxMinorSteps Maximum number of minor steps | |
| \param stepSize Step size. If stepSize == 0.0, the scaleEngine | | \param stepSize Step size. If stepSize == 0.0, the scaleEngine | |
| calculates one. | | calculates one. | |
|
| | | | |
| | | \return Calculated scale division | |
| */ | | */ | |
| virtual QwtScaleDiv divideScale( double x1, double x2, | | virtual QwtScaleDiv divideScale( double x1, double x2, | |
|
| int maxMajSteps, int maxMinSteps, | | int maxMajorSteps, int maxMinorSteps, | |
| double stepSize = 0.0 ) const = 0; | | double stepSize = 0.0 ) const = 0; | |
| | | | |
|
| //! \return a transformation | | void setTransformation( QwtTransform * ); | |
| virtual QwtScaleTransformation *transformation() const = 0; | | QwtTransform *transformation() const; | |
| | | | |
| protected: | | protected: | |
| bool contains( const QwtInterval &, double val ) const; | | bool contains( const QwtInterval &, double val ) const; | |
| QList<double> strip( const QList<double>&, const QwtInterval & ) const; | | QList<double> strip( const QList<double>&, const QwtInterval & ) const; | |
|
| | | | |
| double divideInterval( double interval, int numSteps ) const; | | double divideInterval( double interval, int numSteps ) const; | |
| | | | |
| QwtInterval buildInterval( double v ) const; | | QwtInterval buildInterval( double v ) const; | |
| | | | |
| private: | | private: | |
| class PrivateData; | | class PrivateData; | |
| PrivateData *d_data; | | PrivateData *d_data; | |
| }; | | }; | |
| | | | |
| /*! | | /*! | |
| \brief A scale engine for linear scales | | \brief A scale engine for linear scales | |
| | | | |
| The step size will fit into the pattern | | The step size will fit into the pattern | |
| \f$\left\{ 1,2,5\right\} \cdot 10^{n}\f$, where n is an integer. | | \f$\left\{ 1,2,5\right\} \cdot 10^{n}\f$, where n is an integer. | |
| */ | | */ | |
| | | | |
| class QWT_EXPORT QwtLinearScaleEngine: public QwtScaleEngine | | class QWT_EXPORT QwtLinearScaleEngine: public QwtScaleEngine | |
| { | | { | |
| public: | | public: | |
|
| | | QwtLinearScaleEngine( uint base = 10 ); | |
| | | virtual ~QwtLinearScaleEngine(); | |
| | | | |
| virtual void autoScale( int maxSteps, | | virtual void autoScale( int maxSteps, | |
| double &x1, double &x2, double &stepSize ) const; | | double &x1, double &x2, double &stepSize ) const; | |
| | | | |
| virtual QwtScaleDiv divideScale( double x1, double x2, | | virtual QwtScaleDiv divideScale( double x1, double x2, | |
| int numMajorSteps, int numMinorSteps, | | int numMajorSteps, int numMinorSteps, | |
| double stepSize = 0.0 ) const; | | double stepSize = 0.0 ) const; | |
| | | | |
|
| virtual QwtScaleTransformation *transformation() const; | | | |
| | | | |
| protected: | | protected: | |
| QwtInterval align( const QwtInterval&, double stepSize ) const; | | QwtInterval align( const QwtInterval&, double stepSize ) const; | |
| | | | |
| void buildTicks( | | void buildTicks( | |
| const QwtInterval &, double stepSize, int maxMinSteps, | | const QwtInterval &, double stepSize, int maxMinSteps, | |
| QList<double> ticks[QwtScaleDiv::NTickTypes] ) const; | | QList<double> ticks[QwtScaleDiv::NTickTypes] ) const; | |
| | | | |
| QList<double> buildMajorTicks( | | QList<double> buildMajorTicks( | |
| const QwtInterval &interval, double stepSize ) const; | | const QwtInterval &interval, double stepSize ) const; | |
| | | | |
|
| void buildMinorTicks( | | void buildMinorTicks( const QList<double>& majorTicks, | |
| const QList<double>& majorTicks, | | int maxMinorSteps, double stepSize, | |
| int maxMinMark, double step, | | QList<double> &minorTicks, QList<double> &mediumTicks ) const; | |
| QList<double> &, QList<double> & ) const; | | | |
| }; | | }; | |
| | | | |
| /*! | | /*! | |
|
| \brief A scale engine for logarithmic (base 10) scales | | \brief A scale engine for logarithmic scales | |
| | | | |
| The step size is measured in *decades* | | The step size is measured in *decades* | |
| and the major step size will be adjusted to fit the pattern | | and the major step size will be adjusted to fit the pattern | |
| \f$\left\{ 1,2,3,5\right\} \cdot 10^{n}\f$, where n is a natural number | | \f$\left\{ 1,2,3,5\right\} \cdot 10^{n}\f$, where n is a natural number | |
| including zero. | | including zero. | |
| | | | |
| \warning the step size as well as the margins are measured in *decades*. | | \warning the step size as well as the margins are measured in *decades*. | |
| */ | | */ | |
| | | | |
|
| class QWT_EXPORT QwtLog10ScaleEngine: public QwtScaleEngine | | class QWT_EXPORT QwtLogScaleEngine: public QwtScaleEngine | |
| { | | { | |
| public: | | public: | |
|
| | | QwtLogScaleEngine( uint base = 10 ); | |
| | | virtual ~QwtLogScaleEngine(); | |
| | | | |
| virtual void autoScale( int maxSteps, | | virtual void autoScale( int maxSteps, | |
| double &x1, double &x2, double &stepSize ) const; | | double &x1, double &x2, double &stepSize ) const; | |
| | | | |
| virtual QwtScaleDiv divideScale( double x1, double x2, | | virtual QwtScaleDiv divideScale( double x1, double x2, | |
| int numMajorSteps, int numMinorSteps, | | int numMajorSteps, int numMinorSteps, | |
| double stepSize = 0.0 ) const; | | double stepSize = 0.0 ) const; | |
| | | | |
|
| virtual QwtScaleTransformation *transformation() const; | | | |
| | | | |
| protected: | | protected: | |
|
| QwtInterval log10( const QwtInterval& ) const; | | | |
| QwtInterval pow10( const QwtInterval& ) const; | | | |
| | | | |
| QwtInterval align( const QwtInterval&, double stepSize ) const; | | QwtInterval align( const QwtInterval&, double stepSize ) const; | |
| | | | |
| void buildTicks( | | void buildTicks( | |
| const QwtInterval &, double stepSize, int maxMinSteps, | | const QwtInterval &, double stepSize, int maxMinSteps, | |
| QList<double> ticks[QwtScaleDiv::NTickTypes] ) const; | | QList<double> ticks[QwtScaleDiv::NTickTypes] ) const; | |
| | | | |
| QList<double> buildMajorTicks( | | QList<double> buildMajorTicks( | |
| const QwtInterval &interval, double stepSize ) const; | | const QwtInterval &interval, double stepSize ) const; | |
| | | | |
|
| QList<double> buildMinorTicks( | | void buildMinorTicks( const QList<double>& majorTicks, | |
| const QList<double>& majorTicks, | | int maxMinorSteps, double stepSize, | |
| int maxMinMark, double step ) const; | | QList<double> &minorTicks, QList<double> &mediumTicks ) const; | |
| }; | | }; | |
| | | | |
| Q_DECLARE_OPERATORS_FOR_FLAGS( QwtScaleEngine::Attributes ) | | Q_DECLARE_OPERATORS_FOR_FLAGS( QwtScaleEngine::Attributes ) | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 19 change blocks. |
| 28 lines changed or deleted | | 30 lines changed or added | |
|
| qwt_scale_map.h | | qwt_scale_map.h | |
| | | | |
| skipping to change at line 14 | | skipping to change at line 14 | |
| * Copyright (C) 2002 Uwe Rathmann | | * Copyright (C) 2002 Uwe Rathmann | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_SCALE_MAP_H | | #ifndef QWT_SCALE_MAP_H | |
| #define QWT_SCALE_MAP_H | | #define QWT_SCALE_MAP_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
|
| #include "qwt_math.h" | | #include "qwt_transform.h" | |
| | | #include <qrect.h> | |
| | | | |
| #ifndef QT_NO_DEBUG_STREAM | | #ifndef QT_NO_DEBUG_STREAM | |
| #include <qdebug.h> | | #include <qdebug.h> | |
| #endif | | #endif | |
| | | | |
| class QRectF; | | class QRectF; | |
| | | | |
| /*! | | /*! | |
|
| \brief A transformation between coordinate systems | | | |
| | | | |
| QwtScaleTransformation offers transformations from the coordinate system | | | |
| of a scale into the linear coordinate system of a paint device | | | |
| and vice versa. | | | |
| */ | | | |
| class QWT_EXPORT QwtScaleTransformation | | | |
| { | | | |
| public: | | | |
| //! Transformation type | | | |
| enum Type | | | |
| { | | | |
| //! Transformation between 2 linear scales | | | |
| Linear, | | | |
| | | | |
| //! Transformation between a linear and a logarithmic ( base 10 ) s | | | |
| cale | | | |
| Log10, | | | |
| | | | |
| //! Any other type of transformation | | | |
| Other | | | |
| }; | | | |
| | | | |
| QwtScaleTransformation( Type type ); | | | |
| virtual ~QwtScaleTransformation(); | | | |
| | | | |
| virtual double xForm( double s, double s1, double s2, | | | |
| double p1, double p2 ) const; | | | |
| virtual double invXForm( double p, double p1, double p2, | | | |
| double s1, double s2 ) const; | | | |
| | | | |
| Type type() const; | | | |
| | | | |
| virtual QwtScaleTransformation *copy() const; | | | |
| | | | |
| private: | | | |
| QwtScaleTransformation(); | | | |
| QwtScaleTransformation &operator=( const QwtScaleTransformation ); | | | |
| | | | |
| const Type d_type; | | | |
| }; | | | |
| | | | |
| //! \return Transformation type | | | |
| inline QwtScaleTransformation::Type QwtScaleTransformation::type() const | | | |
| { | | | |
| return d_type; | | | |
| } | | | |
| | | | |
| /*! | | | |
| \brief A scale map | | \brief A scale map | |
| | | | |
| QwtScaleMap offers transformations from the coordinate system | | QwtScaleMap offers transformations from the coordinate system | |
| of a scale into the linear coordinate system of a paint device | | of a scale into the linear coordinate system of a paint device | |
| and vice versa. | | and vice versa. | |
| */ | | */ | |
| class QWT_EXPORT QwtScaleMap | | class QWT_EXPORT QwtScaleMap | |
| { | | { | |
| public: | | public: | |
| QwtScaleMap(); | | QwtScaleMap(); | |
| QwtScaleMap( const QwtScaleMap& ); | | QwtScaleMap( const QwtScaleMap& ); | |
| | | | |
| ~QwtScaleMap(); | | ~QwtScaleMap(); | |
| | | | |
| QwtScaleMap &operator=( const QwtScaleMap & ); | | QwtScaleMap &operator=( const QwtScaleMap & ); | |
| | | | |
|
| void setTransformation( QwtScaleTransformation * ); | | void setTransformation( QwtTransform * ); | |
| const QwtScaleTransformation *transformation() const; | | const QwtTransform *transformation() const; | |
| | | | |
| void setPaintInterval( double p1, double p2 ); | | void setPaintInterval( double p1, double p2 ); | |
| void setScaleInterval( double s1, double s2 ); | | void setScaleInterval( double s1, double s2 ); | |
| | | | |
| double transform( double s ) const; | | double transform( double s ) const; | |
| double invTransform( double p ) const; | | double invTransform( double p ) const; | |
| | | | |
| double p1() const; | | double p1() const; | |
| double p2() const; | | double p2() const; | |
| | | | |
| double s1() const; | | double s1() const; | |
| double s2() const; | | double s2() const; | |
| | | | |
| double pDist() const; | | double pDist() const; | |
| double sDist() const; | | double sDist() const; | |
| | | | |
|
| QT_STATIC_CONST double LogMin; | | | |
| QT_STATIC_CONST double LogMax; | | | |
| | | | |
| static QRectF transform( const QwtScaleMap &, | | static QRectF transform( const QwtScaleMap &, | |
| const QwtScaleMap &, const QRectF & ); | | const QwtScaleMap &, const QRectF & ); | |
| static QRectF invTransform( const QwtScaleMap &, | | static QRectF invTransform( const QwtScaleMap &, | |
| const QwtScaleMap &, const QRectF & ); | | const QwtScaleMap &, const QRectF & ); | |
| | | | |
| static QPointF transform( const QwtScaleMap &, | | static QPointF transform( const QwtScaleMap &, | |
| const QwtScaleMap &, const QPointF & ); | | const QwtScaleMap &, const QPointF & ); | |
| static QPointF invTransform( const QwtScaleMap &, | | static QPointF invTransform( const QwtScaleMap &, | |
| const QwtScaleMap &, const QPointF & ); | | const QwtScaleMap &, const QPointF & ); | |
| | | | |
| bool isInverting() const; | | bool isInverting() const; | |
| | | | |
| private: | | private: | |
|
| void newFactor(); | | void updateFactor(); | |
| | | | |
| double d_s1, d_s2; // scale interval boundaries | | double d_s1, d_s2; // scale interval boundaries | |
| double d_p1, d_p2; // paint device interval boundaries | | double d_p1, d_p2; // paint device interval boundaries | |
| | | | |
| double d_cnv; // conversion factor | | double d_cnv; // conversion factor | |
|
| | | double d_ts1; | |
| | | | |
|
| QwtScaleTransformation *d_transformation; | | QwtTransform *d_transform; | |
| }; | | }; | |
| | | | |
| /*! | | /*! | |
| \return First border of the scale interval | | \return First border of the scale interval | |
| */ | | */ | |
| inline double QwtScaleMap::s1() const | | inline double QwtScaleMap::s1() const | |
| { | | { | |
| return d_s1; | | return d_s1; | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 183 | | skipping to change at line 135 | |
| inline double QwtScaleMap::sDist() const | | inline double QwtScaleMap::sDist() const | |
| { | | { | |
| return qAbs( d_s2 - d_s1 ); | | return qAbs( d_s2 - d_s1 ); | |
| } | | } | |
| | | | |
| /*! | | /*! | |
| Transform a point related to the scale interval into an point | | Transform a point related to the scale interval into an point | |
| related to the interval of the paint device | | related to the interval of the paint device | |
| | | | |
| \param s Value relative to the coordinates of the scale | | \param s Value relative to the coordinates of the scale | |
|
| | | \return Transformed value | |
| | | | |
| | | \sa invTransform() | |
| */ | | */ | |
| inline double QwtScaleMap::transform( double s ) const | | inline double QwtScaleMap::transform( double s ) const | |
| { | | { | |
|
| // try to inline code from QwtScaleTransformation | | if ( d_transform ) | |
| | | s = d_transform->transform( s ); | |
| if ( d_transformation->type() == QwtScaleTransformation::Linear ) | | | |
| return d_p1 + ( s - d_s1 ) * d_cnv; | | | |
| | | | |
|
| if ( d_transformation->type() == QwtScaleTransformation::Log10 ) | | return d_p1 + ( s - d_ts1 ) * d_cnv; | |
| return d_p1 + log( s / d_s1 ) * d_cnv; | | | |
| | | | |
| return d_transformation->xForm( s, d_s1, d_s2, d_p1, d_p2 ); | | | |
| } | | } | |
| | | | |
| /*! | | /*! | |
| Transform an paint device value into a value in the | | Transform an paint device value into a value in the | |
| interval of the scale. | | interval of the scale. | |
| | | | |
| \param p Value relative to the coordinates of the paint device | | \param p Value relative to the coordinates of the paint device | |
|
| | | \return Transformed value | |
| | | | |
| \sa transform() | | \sa transform() | |
| */ | | */ | |
| inline double QwtScaleMap::invTransform( double p ) const | | inline double QwtScaleMap::invTransform( double p ) const | |
| { | | { | |
|
| return d_transformation->invXForm( p, d_p1, d_p2, d_s1, d_s2 ); | | double s = d_ts1 + ( p - d_p1 ) / d_cnv; | |
| | | if ( d_transform ) | |
| | | s = d_transform->invTransform( s ); | |
| | | | |
| | | return s; | |
| } | | } | |
| | | | |
| //! \return True, when ( p1() < p2() ) != ( s1() < s2() ) | | //! \return True, when ( p1() < p2() ) != ( s1() < s2() ) | |
| inline bool QwtScaleMap::isInverting() const | | inline bool QwtScaleMap::isInverting() const | |
| { | | { | |
| return ( ( d_p1 < d_p2 ) != ( d_s1 < d_s2 ) ); | | return ( ( d_p1 < d_p2 ) != ( d_s1 < d_s2 ) ); | |
| } | | } | |
| | | | |
| #ifndef QT_NO_DEBUG_STREAM | | #ifndef QT_NO_DEBUG_STREAM | |
| QWT_EXPORT QDebug operator<<( QDebug, const QwtScaleMap & ); | | QWT_EXPORT QDebug operator<<( QDebug, const QwtScaleMap & ); | |
| | | | |
End of changes. 12 change blocks. |
| 66 lines changed or deleted | | 21 lines changed or added | |
|
| qwt_scale_widget.h | | qwt_scale_widget.h | |
| | | | |
| skipping to change at line 22 | | skipping to change at line 22 | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include "qwt_text.h" | | #include "qwt_text.h" | |
| #include "qwt_scale_draw.h" | | #include "qwt_scale_draw.h" | |
| #include <qwidget.h> | | #include <qwidget.h> | |
| #include <qfont.h> | | #include <qfont.h> | |
| #include <qcolor.h> | | #include <qcolor.h> | |
| #include <qstring.h> | | #include <qstring.h> | |
| | | | |
| class QPainter; | | class QPainter; | |
|
| class QwtScaleTransformation; | | class QwtTransform; | |
| class QwtScaleDiv; | | class QwtScaleDiv; | |
| class QwtColorMap; | | class QwtColorMap; | |
| | | | |
| /*! | | /*! | |
| \brief A Widget which contains a scale | | \brief A Widget which contains a scale | |
| | | | |
| This Widget can be used to decorate composite widgets with | | This Widget can be used to decorate composite widgets with | |
| a scale. | | a scale. | |
| */ | | */ | |
| | | | |
| | | | |
| skipping to change at line 56 | | skipping to change at line 56 | |
| }; | | }; | |
| | | | |
| //! Layout flags of the title | | //! Layout flags of the title | |
| typedef QFlags<LayoutFlag> LayoutFlags; | | typedef QFlags<LayoutFlag> LayoutFlags; | |
| | | | |
| explicit QwtScaleWidget( QWidget *parent = NULL ); | | explicit QwtScaleWidget( QWidget *parent = NULL ); | |
| explicit QwtScaleWidget( QwtScaleDraw::Alignment, QWidget *parent = NUL
L ); | | explicit QwtScaleWidget( QwtScaleDraw::Alignment, QWidget *parent = NUL
L ); | |
| virtual ~QwtScaleWidget(); | | virtual ~QwtScaleWidget(); | |
| | | | |
| Q_SIGNALS: | | Q_SIGNALS: | |
|
| //! Signal emitted, whenever the scale divison changes | | //! Signal emitted, whenever the scale division changes | |
| void scaleDivChanged(); | | void scaleDivChanged(); | |
| | | | |
| public: | | public: | |
| void setTitle( const QString &title ); | | void setTitle( const QString &title ); | |
| void setTitle( const QwtText &title ); | | void setTitle( const QwtText &title ); | |
| QwtText title() const; | | QwtText title() const; | |
| | | | |
| void setLayoutFlag( LayoutFlag, bool on ); | | void setLayoutFlag( LayoutFlag, bool on ); | |
| bool testLayoutFlag( LayoutFlag ) const; | | bool testLayoutFlag( LayoutFlag ) const; | |
| | | | |
| | | | |
| skipping to change at line 82 | | skipping to change at line 82 | |
| | | | |
| void getMinBorderDist( int &start, int &end ) const; | | void getMinBorderDist( int &start, int &end ) const; | |
| void setMinBorderDist( int start, int end ); | | void setMinBorderDist( int start, int end ); | |
| | | | |
| void setMargin( int ); | | void setMargin( int ); | |
| int margin() const; | | int margin() const; | |
| | | | |
| void setSpacing( int td ); | | void setSpacing( int td ); | |
| int spacing() const; | | int spacing() const; | |
| | | | |
|
| void setScaleDiv( QwtScaleTransformation *, const QwtScaleDiv &sd ); | | void setScaleDiv( const QwtScaleDiv &sd ); | |
| | | void setTransformation( QwtTransform * ); | |
| | | | |
| void setScaleDraw( QwtScaleDraw * ); | | void setScaleDraw( QwtScaleDraw * ); | |
| const QwtScaleDraw *scaleDraw() const; | | const QwtScaleDraw *scaleDraw() const; | |
| QwtScaleDraw *scaleDraw(); | | QwtScaleDraw *scaleDraw(); | |
| | | | |
| void setLabelAlignment( Qt::Alignment ); | | void setLabelAlignment( Qt::Alignment ); | |
| void setLabelRotation( double rotation ); | | void setLabelRotation( double rotation ); | |
| | | | |
| void setColorBarEnabled( bool ); | | void setColorBarEnabled( bool ); | |
| bool isColorBarEnabled() const; | | bool isColorBarEnabled() const; | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 4 lines changed or added | |
|
| qwt_series_data.h | | qwt_series_data.h | |
| | | | |
| skipping to change at line 14 | | skipping to change at line 14 | |
| * Copyright (C) 2002 Uwe Rathmann | | * Copyright (C) 2002 Uwe Rathmann | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_SERIES_DATA_H | | #ifndef QWT_SERIES_DATA_H | |
| #define QWT_SERIES_DATA_H 1 | | #define QWT_SERIES_DATA_H 1 | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
|
| #include "qwt_interval.h" | | #include "qwt_samples.h" | |
| #include "qwt_point_3d.h" | | #include "qwt_point_3d.h" | |
| #include "qwt_point_polar.h" | | #include "qwt_point_polar.h" | |
| #include <qvector.h> | | #include <qvector.h> | |
| #include <qrect.h> | | #include <qrect.h> | |
| | | | |
|
| //! \brief A sample of the types (x1-x2, y) or (x, y1-y2) | | | |
| class QWT_EXPORT QwtIntervalSample | | | |
| { | | | |
| public: | | | |
| QwtIntervalSample(); | | | |
| QwtIntervalSample( double, const QwtInterval & ); | | | |
| QwtIntervalSample( double value, double min, double max ); | | | |
| | | | |
| bool operator==( const QwtIntervalSample & ) const; | | | |
| bool operator!=( const QwtIntervalSample & ) const; | | | |
| | | | |
| //! Value | | | |
| double value; | | | |
| | | | |
| //! Interval | | | |
| QwtInterval interval; | | | |
| }; | | | |
| | | | |
| /*! | | | |
| Constructor | | | |
| The value is set to 0.0, the interval is invalid | | | |
| */ | | | |
| inline QwtIntervalSample::QwtIntervalSample(): | | | |
| value( 0.0 ) | | | |
| { | | | |
| } | | | |
| | | | |
| //! Constructor | | | |
| inline QwtIntervalSample::QwtIntervalSample( | | | |
| double v, const QwtInterval &intv ): | | | |
| value( v ), | | | |
| interval( intv ) | | | |
| { | | | |
| } | | | |
| | | | |
| //! Constructor | | | |
| inline QwtIntervalSample::QwtIntervalSample( | | | |
| double v, double min, double max ): | | | |
| value( v ), | | | |
| interval( min, max ) | | | |
| { | | | |
| } | | | |
| | | | |
| //! Compare operator | | | |
| inline bool QwtIntervalSample::operator==( | | | |
| const QwtIntervalSample &other ) const | | | |
| { | | | |
| return value == other.value && interval == other.interval; | | | |
| } | | | |
| | | | |
| //! Compare operator | | | |
| inline bool QwtIntervalSample::operator!=( | | | |
| const QwtIntervalSample &other ) const | | | |
| { | | | |
| return !( *this == other ); | | | |
| } | | | |
| | | | |
| //! \brief A sample of the types (x1...xn, y) or (x, y1..yn) | | | |
| class QWT_EXPORT QwtSetSample | | | |
| { | | | |
| public: | | | |
| QwtSetSample(); | | | |
| bool operator==( const QwtSetSample &other ) const; | | | |
| bool operator!=( const QwtSetSample &other ) const; | | | |
| | | | |
| //! value | | | |
| double value; | | | |
| | | | |
| //! Vector of values associated to value | | | |
| QVector<double> set; | | | |
| }; | | | |
| | | | |
| /*! | | | |
| Constructor | | | |
| The value is set to 0.0 | | | |
| */ | | | |
| inline QwtSetSample::QwtSetSample(): | | | |
| value( 0.0 ) | | | |
| { | | | |
| } | | | |
| | | | |
| //! Compare operator | | | |
| inline bool QwtSetSample::operator==( const QwtSetSample &other ) const | | | |
| { | | | |
| return value == other.value && set == other.set; | | | |
| } | | | |
| | | | |
| //! Compare operator | | | |
| inline bool QwtSetSample::operator!=( const QwtSetSample &other ) const | | | |
| { | | | |
| return !( *this == other ); | | | |
| } | | | |
| | | | |
| /*! | | /*! | |
| \brief Abstract interface for iterating over samples | | \brief Abstract interface for iterating over samples | |
| | | | |
| Qwt offers several implementations of the QwtSeriesData API, | | Qwt offers several implementations of the QwtSeriesData API, | |
| but in situations, where data of an application specific format | | but in situations, where data of an application specific format | |
| needs to be displayed, without having to copy it, it is recommended | | needs to be displayed, without having to copy it, it is recommended | |
| to implement an individual data access. | | to implement an individual data access. | |
| | | | |
| A subclass of QwtSeriesData<QPointF> must implement: | | A subclass of QwtSeriesData<QPointF> must implement: | |
| | | | |
| | | | |
| skipping to change at line 134 | | skipping to change at line 41 | |
| Should return number of data points. | | Should return number of data points. | |
| | | | |
| - sample()\n | | - sample()\n | |
| Should return values x and y values of the sample at specific position | | Should return values x and y values of the sample at specific position | |
| as QPointF object. | | as QPointF object. | |
| | | | |
| - boundingRect()\n | | - boundingRect()\n | |
| Should return the bounding rectangle of the data series. | | Should return the bounding rectangle of the data series. | |
| It is used for autoscaling and might help certain algorithms for displ
aying | | It is used for autoscaling and might help certain algorithms for displ
aying | |
| the data. You can use qwtBoundingRect() for an implementation | | the data. You can use qwtBoundingRect() for an implementation | |
|
| but often it is possible to implement a more efficient alogrithm | | but often it is possible to implement a more efficient algorithm | |
| depending on the characteristics of the series. | | depending on the characteristics of the series. | |
| The member d_boundingRect is intended for caching the calculated recta
ngle. | | The member d_boundingRect is intended for caching the calculated recta
ngle. | |
| | | | |
| */ | | */ | |
| template <typename T> | | template <typename T> | |
| class QwtSeriesData | | class QwtSeriesData | |
| { | | { | |
| public: | | public: | |
| //! Constructor | | //! Constructor | |
| QwtSeriesData(); | | QwtSeriesData(); | |
| | | | |
| skipping to change at line 167 | | skipping to change at line 74 | |
| virtual T sample( size_t i ) const = 0; | | virtual T sample( size_t i ) const = 0; | |
| | | | |
| /*! | | /*! | |
| Calculate the bounding rect of all samples | | Calculate the bounding rect of all samples | |
| | | | |
| The bounding rect is necessary for autoscaling and can be used | | The bounding rect is necessary for autoscaling and can be used | |
| for a couple of painting optimizations. | | for a couple of painting optimizations. | |
| | | | |
| qwtBoundingRect(...) offers slow implementations iterating | | qwtBoundingRect(...) offers slow implementations iterating | |
| over the samples. For large sets it is recommended to implement | | over the samples. For large sets it is recommended to implement | |
|
| something faster f.e. by caching the bounding rect. | | something faster f.e. by caching the bounding rectangle. | |
| | | | |
| | | \return Bounding rectangle | |
| */ | | */ | |
| virtual QRectF boundingRect() const = 0; | | virtual QRectF boundingRect() const = 0; | |
| | | | |
| /*! | | /*! | |
| Set a the "rect of interest" | | Set a the "rect of interest" | |
| | | | |
| QwtPlotSeriesItem defines the current area of the plot canvas | | QwtPlotSeriesItem defines the current area of the plot canvas | |
|
| as "rect of interest" ( QwtPlotSeriesItem::updateScaleDiv() ). | | as "rectangle of interest" ( QwtPlotSeriesItem::updateScaleDiv() ). | |
| It can be used to implement different levels of details. | | It can be used to implement different levels of details. | |
| | | | |
| The default implementation does nothing. | | The default implementation does nothing. | |
| | | | |
| \param rect Rectangle of interest | | \param rect Rectangle of interest | |
| */ | | */ | |
| virtual void setRectOfInterest( const QRectF &rect ); | | virtual void setRectOfInterest( const QRectF &rect ); | |
| | | | |
| protected: | | protected: | |
| //! Can be used to cache a calculated bounding rectangle | | //! Can be used to cache a calculated bounding rectangle | |
| | | | |
| skipping to change at line 243 | | skipping to change at line 152 | |
| //! \return Array of samples | | //! \return Array of samples | |
| const QVector<T> samples() const; | | const QVector<T> samples() const; | |
| | | | |
| //! \return Number of samples | | //! \return Number of samples | |
| virtual size_t size() const; | | virtual size_t size() const; | |
| | | | |
| /*! | | /*! | |
| \return Sample at a specific position | | \return Sample at a specific position | |
| | | | |
| \param index Index | | \param index Index | |
|
| \return Sample at position i | | \return Sample at position index | |
| */ | | */ | |
| virtual T sample( size_t index ) const; | | virtual T sample( size_t index ) const; | |
| | | | |
| protected: | | protected: | |
| //! Vector of samples | | //! Vector of samples | |
| QVector<T> d_samples; | | QVector<T> d_samples; | |
| }; | | }; | |
| | | | |
| template <typename T> | | template <typename T> | |
| QwtArraySeriesData<T>::QwtArraySeriesData() | | QwtArraySeriesData<T>::QwtArraySeriesData() | |
| | | | |
| skipping to change at line 328 | | skipping to change at line 237 | |
| class QWT_EXPORT QwtSetSeriesData: public QwtArraySeriesData<QwtSetSample> | | class QWT_EXPORT QwtSetSeriesData: public QwtArraySeriesData<QwtSetSample> | |
| { | | { | |
| public: | | public: | |
| QwtSetSeriesData( | | QwtSetSeriesData( | |
| const QVector<QwtSetSample> & = QVector<QwtSetSample>() ); | | const QVector<QwtSetSample> & = QVector<QwtSetSample>() ); | |
| | | | |
| virtual QRectF boundingRect() const; | | virtual QRectF boundingRect() const; | |
| }; | | }; | |
| | | | |
| /*! | | /*! | |
|
| \brief Interface for iterating over two QVector<double> objects. | | Interface for iterating over an array of OHLC samples | |
| */ | | */ | |
|
| class QWT_EXPORT QwtPointArrayData: public QwtSeriesData<QPointF> | | class QWT_EXPORT QwtTradingChartData: public QwtArraySeriesData<QwtOHLCSamp
le> | |
| { | | { | |
| public: | | public: | |
|
| QwtPointArrayData( const QVector<double> &x, const QVector<double> &y ) | | QwtTradingChartData( | |
| ; | | const QVector<QwtOHLCSample> & = QVector<QwtOHLCSample>() ); | |
| QwtPointArrayData( const double *x, const double *y, size_t size ); | | | |
| | | | |
| virtual QRectF boundingRect() const; | | virtual QRectF boundingRect() const; | |
|
| | | }; | |
| | | | |
|
| virtual size_t size() const; | | QWT_EXPORT QRectF qwtBoundingRect( | |
| virtual QPointF sample( size_t i ) const; | | const QwtSeriesData<QPointF> &, int from = 0, int to = -1 ); | |
| | | | |
| const QVector<double> &xData() const; | | | |
| const QVector<double> &yData() const; | | | |
| | | | |
|
| private: | | QWT_EXPORT QRectF qwtBoundingRect( | |
| QVector<double> d_x; | | const QwtSeriesData<QwtPoint3D> &, int from = 0, int to = -1 ); | |
| QVector<double> d_y; | | | |
| }; | | | |
| | | | |
|
| /*! | | QWT_EXPORT QRectF qwtBoundingRect( | |
| \brief Data class containing two pointers to memory blocks of doubles. | | const QwtSeriesData<QwtPointPolar> &, int from = 0, int to = -1 ); | |
| */ | | | |
| class QWT_EXPORT QwtCPointerData: public QwtSeriesData<QPointF> | | | |
| { | | | |
| public: | | | |
| QwtCPointerData( const double *x, const double *y, size_t size ); | | | |
| | | | |
|
| virtual QRectF boundingRect() const; | | QWT_EXPORT QRectF qwtBoundingRect( | |
| virtual size_t size() const; | | const QwtSeriesData<QwtIntervalSample> &, int from = 0, int to = -1 ); | |
| virtual QPointF sample( size_t i ) const; | | | |
| | | | |
|
| const double *xData() const; | | QWT_EXPORT QRectF qwtBoundingRect( | |
| const double *yData() const; | | const QwtSeriesData<QwtSetSample> &, int from = 0, int to = -1 ); | |
| | | | |
|
| private: | | QWT_EXPORT QRectF qwtBoundingRect( | |
| const double *d_x; | | const QwtSeriesData<QwtOHLCSample> &, int from = 0, int to = -1 ); | |
| const double *d_y; | | | |
| size_t d_size; | | | |
| }; | | | |
| | | | |
| /*! | | /*! | |
|
| \brief Synthetic point data | | Binary search for a sorted series of samples | |
| | | | |
| QwtSyntheticPointData provides a fixed number of points for an interval. | | | |
| The points are calculated in equidistant steps in x-direction. | | | |
| | | | |
|
| If the interval is invalid, the points are calculated for | | qwtUpperSampleIndex returns the index of sample that is the upper bound | |
| the "rect of interest", what normally is the displayed area on the | | of value. Is the the value smaller than the smallest value the return | |
| plot canvas. In this mode you get different levels of detail, when | | value will be 0. Is the value greater or equal than the largest | |
| zooming in/out. | | value the return value will be -1. | |
| | | | |
| \par Example | | \par Example | |
|
| | | The following example shows finds a point of curve from an x | |
| The following example shows how to implement a sinus curve. | | coordinate | |
| | | | |
| \verbatim | | \verbatim | |
|
| #include <cmath> | | | |
| #include <qwt_series_data.h> | | #include <qwt_series_data.h> | |
| #include <qwt_plot_curve.h> | | #include <qwt_plot_curve.h> | |
|
| #include <qwt_plot.h> | | | |
| #include <qapplication.h> | | | |
| | | | |
|
| class SinusData: public QwtSyntheticPointData | | struct compareX | |
| { | | { | |
|
| public: | | inline bool operator()( const double x, const QPointF &pos ) const | |
| SinusData(): | | | |
| QwtSyntheticPointData(100) | | | |
| { | | | |
| } | | | |
| virtual double y(double x) const | | | |
| { | | { | |
|
| return qSin(x); | | return ( x < pos.x() ); | |
| } | | } | |
| }; | | }; | |
| | | | |
|
| int main(int argc, char **argv) | | QLineF curveLineAt( const QwtPlotCurve *curve, double x ) | |
| { | | { | |
|
| QApplication a(argc, argv); | | int index = qwtUpperSampleIndex<QPointF>( | |
| | | *curve->data(), x, compareX() ); | |
| | | | |
|
| QwtPlot plot; | | if ( index == -1 && | |
| plot.setAxisScale(QwtPlot::xBottom, 0.0, 10.0); | | x == curve->sample( curve->dataSize() - 1 ).x() ) | |
| plot.setAxisScale(QwtPlot::yLeft, -1.0, 1.0); | | { | |
| | | // the last sample is excluded from qwtUpperSampleIndex | |
| | | index = curve->dataSize() - 1; | |
| | | } | |
| | | | |
|
| QwtPlotCurve *curve = new QwtPlotCurve("y = sin(x)"); | | QLineF line; // invalid | |
| curve->setData(SinusData()); | | if ( index > 0 ) | |
| curve->attach(&plot); | | { | |
| | | line.setP1( curve->sample( index - 1 ) ); | |
| | | line.setP2( curve->sample( index ) ); | |
| | | } | |
| | | | |
|
| plot.show(); | | return line; | |
| return a.exec(); | | | |
| } | | } | |
|
| \endverbatim | | | |
| */ | | | |
| class QWT_EXPORT QwtSyntheticPointData: public QwtSeriesData<QPointF> | | | |
| { | | | |
| public: | | | |
| QwtSyntheticPointData( size_t size, | | | |
| const QwtInterval & = QwtInterval() ); | | | |
| | | | |
|
| void setSize( size_t size ); | | \endverbatim | |
| size_t size() const; | | | |
| | | | |
|
| void setInterval( const QwtInterval& ); | | \param series Series of samples | |
| QwtInterval interval() const; | | \param value Value | |
| | | \param lessThan Compare operation | |
| | | | |
|
| virtual QRectF boundingRect() const; | | \note The samples must be sorted according to the order specified | |
| virtual QPointF sample( size_t i ) const; | | by the lessThan object | |
| | | | |
|
| /*! | | of the range [begin, end) and returns the position of the one-past-the-last | |
| Calculate a y value for a x value | | occurrence of value. If no such item is found, returns the position where | |
| | | the item should be inserted. | |
| | | */ | |
| | | template <typename T, typename LessThan> | |
| | | inline int qwtUpperSampleIndex( const QwtSeriesData<T> &series, | |
| | | double value, LessThan lessThan ) | |
| | | { | |
| | | const int indexMax = series.size() - 1; | |
| | | | |
|
| \param x x value | | if ( indexMax < 0 || !lessThan( value, series.sample( indexMax ) ) ) | |
| \return Corresponding y value | | return -1; | |
| */ | | | |
| virtual double y( double x ) const = 0; | | | |
| virtual double x( uint index ) const; | | | |
| | | | |
|
| virtual void setRectOfInterest( const QRectF & ); | | int indexMin = 0; | |
| QRectF rectOfInterest() const; | | int n = indexMax; | |
| | | | |
|
| private: | | while ( n > 0 ) | |
| size_t d_size; | | { | |
| QwtInterval d_interval; | | const int half = n >> 1; | |
| QRectF d_rectOfInterest; | | const int indexMid = indexMin + half; | |
| QwtInterval d_intervalOfInterest; | | | |
| }; | | | |
| | | | |
|
| QWT_EXPORT QRectF qwtBoundingRect( | | if ( lessThan( value, series.sample( indexMid ) ) ) | |
| const QwtSeriesData<QPointF> &, int from = 0, int to = -1 ); | | { | |
| QWT_EXPORT QRectF qwtBoundingRect( | | n = half; | |
| const QwtSeriesData<QwtPoint3D> &, int from = 0, int to = -1 ); | | } | |
| QWT_EXPORT QRectF qwtBoundingRect( | | else | |
| const QwtSeriesData<QwtPointPolar> &, int from = 0, int to = -1 ); | | { | |
| QWT_EXPORT QRectF qwtBoundingRect( | | indexMin = indexMid + 1; | |
| const QwtSeriesData<QwtIntervalSample> &, int from = 0, int to = -1 ); | | n -= half + 1; | |
| QWT_EXPORT QRectF qwtBoundingRect( | | } | |
| const QwtSeriesData<QwtSetSample> &, int from = 0, int to = -1 ); | | } | |
| | | | |
| | | return indexMin; | |
| | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 38 change blocks. |
| 198 lines changed or deleted | | 86 lines changed or added | |
|
| qwt_slider.h | | qwt_slider.h | |
| | | | |
| skipping to change at line 14 | | skipping to change at line 14 | |
| * Copyright (C) 2002 Uwe Rathmann | | * Copyright (C) 2002 Uwe Rathmann | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_SLIDER_H | | #ifndef QWT_SLIDER_H | |
| #define QWT_SLIDER_H | | #define QWT_SLIDER_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
|
| #include "qwt_abstract_scale.h" | | | |
| #include "qwt_abstract_slider.h" | | #include "qwt_abstract_slider.h" | |
| | | | |
| class QwtScaleDraw; | | class QwtScaleDraw; | |
| | | | |
| /*! | | /*! | |
| \brief The Slider Widget | | \brief The Slider Widget | |
| | | | |
| QwtSlider is a slider widget which operates on an interval | | QwtSlider is a slider widget which operates on an interval | |
|
| of type double. QwtSlider supports different layouts as | | of type double. Its position is related to a scale showing | |
| well as a scale. | | the current value. | |
| | | | |
|
| \image html sliders.png | | The slider can be customized by having a through, a groove - or both. | |
| | | | |
|
| \sa QwtAbstractSlider and QwtAbstractScale for the descriptions | | \image html sliders.png | |
| of the inherited members. | | | |
| */ | | */ | |
| | | | |
|
| class QWT_EXPORT QwtSlider : public QwtAbstractSlider, public QwtAbstractSc
ale | | class QWT_EXPORT QwtSlider: public QwtAbstractSlider | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
|
| Q_ENUMS( ScalePos ) | | | |
| Q_ENUMS( BackgroundStyle ) | | Q_ENUMS( ScalePosition BackgroundStyle ) | |
| Q_PROPERTY( ScalePos scalePosition READ scalePosition | | | |
| | | Q_PROPERTY( Qt::Orientation orientation | |
| | | READ orientation WRITE setOrientation ) | |
| | | Q_PROPERTY( ScalePosition scalePosition READ scalePosition | |
| WRITE setScalePosition ) | | WRITE setScalePosition ) | |
|
| Q_PROPERTY( BackgroundStyles backgroundStyle | | | |
| READ backgroundStyle WRITE setBackgroundStyle ) | | Q_PROPERTY( bool trough READ hasTrough WRITE setTrough ) | |
| | | Q_PROPERTY( bool groove READ hasGroove WRITE setGroove ) | |
| | | | |
| Q_PROPERTY( QSize handleSize READ handleSize WRITE setHandleSize ) | | Q_PROPERTY( QSize handleSize READ handleSize WRITE setHandleSize ) | |
| Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth ) | | Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth ) | |
| Q_PROPERTY( int spacing READ spacing WRITE setSpacing ) | | Q_PROPERTY( int spacing READ spacing WRITE setSpacing ) | |
| | | | |
| public: | | public: | |
| | | | |
| /*! | | /*! | |
|
| Scale position. QwtSlider tries to enforce valid combinations of its | | Position of the scale | |
| orientation and scale position: | | \sa QwtSlider(), setScalePosition(), setOrientation() | |
| | | | |
| - Qt::Horizonal combines with NoScale, TopScale and BottomScale | | | |
| - Qt::Vertical combines with NoScale, LeftScale and RightScale | | | |
| | | | |
| \sa QwtSlider() | | | |
| */ | | */ | |
|
| enum ScalePos | | enum ScalePosition | |
| { | | { | |
| //! The slider has no scale | | //! The slider has no scale | |
| NoScale, | | NoScale, | |
| | | | |
|
| //! The scale is left of the slider | | //! The scale is right of a vertical or below a horizontal slider | |
| LeftScale, | | LeadingScale, | |
| | | | |
| //! The scale is right of the slider | | | |
| RightScale, | | | |
| | | | |
| //! The scale is above of the slider | | | |
| TopScale, | | | |
| | | | |
| //! The scale is below of the slider | | | |
| BottomScale | | | |
| }; | | | |
| | | | |
| /*! | | | |
| Background style. | | | |
| \sa QwtSlider() | | | |
| */ | | | |
| enum BackgroundStyle | | | |
| { | | | |
| //! Trough background | | | |
| Trough = 0x01, | | | |
| | | | |
|
| //! Groove | | //! The scale is left of a vertical or above a horizontal slider | |
| Groove = 0x02, | | TrailingScale | |
| }; | | }; | |
| | | | |
|
| //! Background styles | | explicit QwtSlider( QWidget *parent = NULL ); | |
| typedef QFlags<BackgroundStyle> BackgroundStyles; | | explicit QwtSlider( Qt::Orientation, QWidget *parent = NULL ); | |
| | | | |
| explicit QwtSlider( QWidget *parent, | | | |
| Qt::Orientation = Qt::Horizontal, | | | |
| ScalePos = NoScale, BackgroundStyles = Trough ); | | | |
| | | | |
| virtual ~QwtSlider(); | | virtual ~QwtSlider(); | |
| | | | |
|
| virtual void setOrientation( Qt::Orientation ); | | void setOrientation( Qt::Orientation ); | |
| | | Qt::Orientation orientation() const; | |
| | | | |
|
| void setBackgroundStyle( BackgroundStyles ); | | void setScalePosition( ScalePosition ); | |
| BackgroundStyles backgroundStyle() const; | | ScalePosition scalePosition() const; | |
| | | | |
|
| void setScalePosition( ScalePos s ); | | void setTrough( bool ); | |
| ScalePos scalePosition() const; | | bool hasTrough() const; | |
| | | | |
| | | void setGroove( bool ); | |
| | | bool hasGroove() const; | |
| | | | |
|
| void setHandleSize( int width, int height ); | | | |
| void setHandleSize( const QSize & ); | | void setHandleSize( const QSize & ); | |
| QSize handleSize() const; | | QSize handleSize() const; | |
| | | | |
| void setBorderWidth( int bw ); | | void setBorderWidth( int bw ); | |
| int borderWidth() const; | | int borderWidth() const; | |
| | | | |
| void setSpacing( int ); | | void setSpacing( int ); | |
| int spacing() const; | | int spacing() const; | |
| | | | |
| virtual QSize sizeHint() const; | | virtual QSize sizeHint() const; | |
| virtual QSize minimumSizeHint() const; | | virtual QSize minimumSizeHint() const; | |
| | | | |
| void setScaleDraw( QwtScaleDraw * ); | | void setScaleDraw( QwtScaleDraw * ); | |
| const QwtScaleDraw *scaleDraw() const; | | const QwtScaleDraw *scaleDraw() const; | |
| | | | |
|
| | | void setUpdateInterval( int ); | |
| | | int updateInterval() const; | |
| | | | |
| protected: | | protected: | |
|
| virtual double getValue( const QPoint &p ); | | virtual double scrolledTo( const QPoint & ) const; | |
| virtual void getScrollMode( const QPoint &p, | | virtual bool isScrollPosition( const QPoint & ) const; | |
| QwtAbstractSlider::ScrollMode &, int &direction ) const; | | | |
| | | | |
| virtual void drawSlider ( QPainter *, const QRect & ) const; | | virtual void drawSlider ( QPainter *, const QRect & ) const; | |
| virtual void drawHandle( QPainter *, const QRect &, int pos ) const; | | virtual void drawHandle( QPainter *, const QRect &, int pos ) const; | |
| | | | |
|
| | | virtual void mousePressEvent( QMouseEvent * ); | |
| | | virtual void mouseReleaseEvent( QMouseEvent * ); | |
| virtual void resizeEvent( QResizeEvent * ); | | virtual void resizeEvent( QResizeEvent * ); | |
| virtual void paintEvent ( QPaintEvent * ); | | virtual void paintEvent ( QPaintEvent * ); | |
| virtual void changeEvent( QEvent * ); | | virtual void changeEvent( QEvent * ); | |
|
| | | virtual void timerEvent( QTimerEvent * ); | |
| | | | |
|
| virtual void valueChange(); | | | |
| virtual void rangeChange(); | | | |
| virtual void scaleChange(); | | virtual void scaleChange(); | |
| | | | |
|
| int transform( double v ) const; | | QRect sliderRect() const; | |
| | | QRect handleRect() const; | |
| | | | |
|
| | | private: | |
| QwtScaleDraw *scaleDraw(); | | QwtScaleDraw *scaleDraw(); | |
| | | | |
|
| private: | | | |
| void layoutSlider( bool ); | | void layoutSlider( bool ); | |
|
| void initSlider( Qt::Orientation, ScalePos, BackgroundStyles ); | | void initSlider( Qt::Orientation ); | |
| | | | |
| class PrivateData; | | class PrivateData; | |
| PrivateData *d_data; | | PrivateData *d_data; | |
| }; | | }; | |
| | | | |
|
| Q_DECLARE_OPERATORS_FOR_FLAGS( QwtSlider::BackgroundStyles ) | | | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 26 change blocks. |
| 65 lines changed or deleted | | 45 lines changed or added | |
|
| qwt_symbol.h | | qwt_symbol.h | |
| | | | |
| skipping to change at line 14 | | skipping to change at line 14 | |
| * Copyright (C) 2002 Uwe Rathmann | | * Copyright (C) 2002 Uwe Rathmann | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_SYMBOL_H | | #ifndef QWT_SYMBOL_H | |
| #define QWT_SYMBOL_H | | #define QWT_SYMBOL_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
|
| #include <QPolygonF> | | #include <qpolygon.h> | |
| | | | |
| class QPainter; | | class QPainter; | |
| class QRect; | | class QRect; | |
| class QSize; | | class QSize; | |
| class QBrush; | | class QBrush; | |
| class QPen; | | class QPen; | |
| class QColor; | | class QColor; | |
| class QPointF; | | class QPointF; | |
|
| | | class QPolygonF; | |
| | | class QPainterPath; | |
| | | class QPixmap; | |
| | | class QByteArray; | |
| | | class QwtGraphic; | |
| | | | |
| //! A class for drawing symbols | | //! A class for drawing symbols | |
| class QWT_EXPORT QwtSymbol | | class QWT_EXPORT QwtSymbol | |
| { | | { | |
| public: | | public: | |
| /*! | | /*! | |
| Symbol Style | | Symbol Style | |
| \sa setStyle(), style() | | \sa setStyle(), style() | |
| */ | | */ | |
| enum Style | | enum Style | |
| | | | |
| skipping to change at line 83 | | skipping to change at line 88 | |
| //! X combined with + | | //! X combined with + | |
| Star1, | | Star1, | |
| | | | |
| //! Six-pointed star | | //! Six-pointed star | |
| Star2, | | Star2, | |
| | | | |
| //! Hexagon | | //! Hexagon | |
| Hexagon, | | Hexagon, | |
| | | | |
| /*! | | /*! | |
|
| | | The symbol is represented by a painter path, where the | |
| | | origin ( 0, 0 ) of the path coordinate system is mapped to | |
| | | the position of the symbol. | |
| | | | |
| | | \sa setPath(), path() | |
| | | */ | |
| | | Path, | |
| | | | |
| | | /*! | |
| | | The symbol is represented by a pixmap. The pixmap is centered | |
| | | or aligned to its pin point. | |
| | | | |
| | | \sa setPinPoint() | |
| | | */ | |
| | | Pixmap, | |
| | | | |
| | | /*! | |
| | | The symbol is represented by a graphic. The graphic is centered | |
| | | or aligned to its pin point. | |
| | | | |
| | | \sa setPinPoint() | |
| | | */ | |
| | | Graphic, | |
| | | | |
| | | /*! | |
| | | The symbol is represented by a SVG graphic. The graphic is center | |
| | | ed | |
| | | or aligned to its pin point. | |
| | | | |
| | | \sa setPinPoint() | |
| | | */ | |
| | | SvgDocument, | |
| | | | |
| | | /*! | |
| Styles >= QwtSymbol::UserSymbol are reserved for derived | | Styles >= QwtSymbol::UserSymbol are reserved for derived | |
| classes of QwtSymbol that overload drawSymbols() with | | classes of QwtSymbol that overload drawSymbols() with | |
| additional application specific symbol types. | | additional application specific symbol types. | |
| */ | | */ | |
| UserStyle = 1000 | | UserStyle = 1000 | |
| }; | | }; | |
| | | | |
|
| | | /*! | |
| | | Depending on the render engine and the complexity of the | |
| | | symbol shape it might be faster to render the symbol | |
| | | to a pixmap and to paint this pixmap. | |
| | | | |
| | | F.e. the raster paint engine is a pure software renderer | |
| | | where in cache mode a draw operation usually ends in | |
| | | raster operation with the the backing store, that are usually | |
| | | faster, than the algorithms for rendering polygons. | |
| | | But the opposite can be expected for graphic pipelines | |
| | | that can make use of hardware acceleration. | |
| | | | |
| | | The default setting is AutoCache | |
| | | | |
| | | \sa setCachePolicy(), cachePolicy() | |
| | | | |
| | | \note The policy has no effect, when the symbol is painted | |
| | | to a vector graphics format ( PDF, SVG ). | |
| | | \warning Since Qt 4.8 raster is the default backend on X11 | |
| | | */ | |
| | | | |
| | | enum CachePolicy | |
| | | { | |
| | | //! Don't use a pixmap cache | |
| | | NoCache, | |
| | | | |
| | | //! Always use a pixmap cache | |
| | | Cache, | |
| | | | |
| | | /*! | |
| | | Use a cache when one of the following conditions is true: | |
| | | | |
| | | - The symbol is rendered with the software | |
| | | renderer ( QPaintEngine::Raster ) | |
| | | */ | |
| | | AutoCache | |
| | | }; | |
| | | | |
| public: | | public: | |
| QwtSymbol( Style = NoSymbol ); | | QwtSymbol( Style = NoSymbol ); | |
| QwtSymbol( Style, const QBrush &, const QPen &, const QSize & ); | | QwtSymbol( Style, const QBrush &, const QPen &, const QSize & ); | |
|
| QwtSymbol( const QwtSymbol & ); | | QwtSymbol( const QPainterPath &, const QBrush &, const QPen & ); | |
| | | | |
| virtual ~QwtSymbol(); | | virtual ~QwtSymbol(); | |
| | | | |
|
| QwtSymbol &operator=( const QwtSymbol & ); | | void setCachePolicy( CachePolicy ); | |
| bool operator==( const QwtSymbol & ) const; | | CachePolicy cachePolicy() const; | |
| bool operator!=( const QwtSymbol & ) const; | | | |
| | | | |
| void setSize( const QSize & ); | | void setSize( const QSize & ); | |
| void setSize( int width, int height = -1 ); | | void setSize( int width, int height = -1 ); | |
| const QSize& size() const; | | const QSize& size() const; | |
| | | | |
|
| | | void setPinPoint( const QPointF &pos, bool enable = true ); | |
| | | QPointF pinPoint() const; | |
| | | | |
| | | void setPinPointEnabled( bool ); | |
| | | bool isPinPointEnabled() const; | |
| | | | |
| virtual void setColor( const QColor & ); | | virtual void setColor( const QColor & ); | |
| | | | |
| void setBrush( const QBrush& b ); | | void setBrush( const QBrush& b ); | |
| const QBrush& brush() const; | | const QBrush& brush() const; | |
| | | | |
|
| | | void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::Soli
dLine ); | |
| void setPen( const QPen & ); | | void setPen( const QPen & ); | |
| const QPen& pen() const; | | const QPen& pen() const; | |
| | | | |
| void setStyle( Style ); | | void setStyle( Style ); | |
| Style style() const; | | Style style() const; | |
| | | | |
|
| | | void setPath( const QPainterPath & ); | |
| | | const QPainterPath &path() const; | |
| | | | |
| | | void setPixmap( const QPixmap & ); | |
| | | const QPixmap &pixmap() const; | |
| | | | |
| | | void setGraphic( const QwtGraphic & ); | |
| | | const QwtGraphic &graphic() const; | |
| | | | |
| | | #ifndef QWT_NO_SVG | |
| | | void setSvgDocument( const QByteArray & ); | |
| | | #endif | |
| | | | |
| | | void drawSymbol( QPainter *, const QRectF & ) const; | |
| void drawSymbol( QPainter *, const QPointF & ) const; | | void drawSymbol( QPainter *, const QPointF & ) const; | |
| void drawSymbols( QPainter *, const QPolygonF & ) const; | | void drawSymbols( QPainter *, const QPolygonF & ) const; | |
|
| | | void drawSymbols( QPainter *, | |
| | | const QPointF *, int numPoints ) const; | |
| | | | |
|
| virtual QSize boundingSize() const; | | virtual QRect boundingRect() const; | |
| | | void invalidateCache(); | |
| | | | |
| protected: | | protected: | |
|
| virtual void drawSymbols( QPainter *, | | virtual void renderSymbols( QPainter *, | |
| const QPointF *, int numPoints ) const; | | const QPointF *, int numPoints ) const; | |
| | | | |
| private: | | private: | |
|
| | | // Disabled copy constructor and operator= | |
| | | QwtSymbol( const QwtSymbol & ); | |
| | | QwtSymbol &operator=( const QwtSymbol & ); | |
| | | | |
| class PrivateData; | | class PrivateData; | |
| PrivateData *d_data; | | PrivateData *d_data; | |
| }; | | }; | |
| | | | |
| /*! | | /*! | |
| \brief Draw the symbol at a specified position | | \brief Draw the symbol at a specified position | |
| | | | |
| \param painter Painter | | \param painter Painter | |
| \param pos Position of the symbol in screen coordinates | | \param pos Position of the symbol in screen coordinates | |
| */ | | */ | |
| | | | |
End of changes. 13 change blocks. |
| 7 lines changed or deleted | | 112 lines changed or added | |
|
| qwt_text.h | | qwt_text.h | |
| | | | |
| skipping to change at line 17 | | skipping to change at line 17 | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_TEXT_H | | #ifndef QWT_TEXT_H | |
| #define QWT_TEXT_H | | #define QWT_TEXT_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include <qstring.h> | | #include <qstring.h> | |
| #include <qsize.h> | | #include <qsize.h> | |
| #include <qfont.h> | | #include <qfont.h> | |
|
| | | #include <qmetatype.h> | |
| | | | |
| class QColor; | | class QColor; | |
| class QPen; | | class QPen; | |
| class QBrush; | | class QBrush; | |
| class QRectF; | | class QRectF; | |
| class QPainter; | | class QPainter; | |
| class QwtTextEngine; | | class QwtTextEngine; | |
| | | | |
| /*! | | /*! | |
| \brief A class representing a text | | \brief A class representing a text | |
| | | | |
| A QwtText is a text including a set of attributes how to render it. | | A QwtText is a text including a set of attributes how to render it. | |
| | | | |
| - Format\n | | - Format\n | |
| A text might include control sequences (f.e tags) describing | | A text might include control sequences (f.e tags) describing | |
| how to render it. Each format (f.e MathML, TeX, Qt Rich Text) | | how to render it. Each format (f.e MathML, TeX, Qt Rich Text) | |
| has its own set of control sequences, that can be handles by | | has its own set of control sequences, that can be handles by | |
|
| a QwtTextEngine for this format. | | a special QwtTextEngine for this format. | |
| - Background\n | | - Background\n | |
| A text might have a background, defined by a QPen and QBrush | | A text might have a background, defined by a QPen and QBrush | |
|
| to improve its visibility. | | to improve its visibility. The corners of the background might | |
| | | be rounded. | |
| - Font\n | | - Font\n | |
| A text might have an individual font. | | A text might have an individual font. | |
| - Color\n | | - Color\n | |
| A text might have an individual color. | | A text might have an individual color. | |
| - Render Flags\n | | - Render Flags\n | |
| Flags from Qt::AlignmentFlag and Qt::TextFlag used like in | | Flags from Qt::AlignmentFlag and Qt::TextFlag used like in | |
|
| QPainter::drawText. | | QPainter::drawText(). | |
| | | | |
| \sa QwtTextEngine, QwtTextLabel | | \sa QwtTextEngine, QwtTextLabel | |
| */ | | */ | |
| | | | |
| class QWT_EXPORT QwtText | | class QWT_EXPORT QwtText | |
| { | | { | |
| public: | | public: | |
| | | | |
| /*! | | /*! | |
| \brief Text format | | \brief Text format | |
| | | | |
| The text format defines the QwtTextEngine, that is used to render | | The text format defines the QwtTextEngine, that is used to render | |
| the text. | | the text. | |
| | | | |
| \sa QwtTextEngine, setTextEngine() | | \sa QwtTextEngine, setTextEngine() | |
| */ | | */ | |
| | | | |
| enum TextFormat | | enum TextFormat | |
| { | | { | |
| /*! | | /*! | |
|
| The text format is determined using QwtTextEngine::mightRender fo
r | | The text format is determined using QwtTextEngine::mightRender()
for | |
| all available text engines in increasing order > PlainText. | | all available text engines in increasing order > PlainText. | |
| If none of the text engines can render the text is rendered | | If none of the text engines can render the text is rendered | |
| like QwtText::PlainText. | | like QwtText::PlainText. | |
| */ | | */ | |
| AutoText = 0, | | AutoText = 0, | |
| | | | |
| //! Draw the text as it is, using a QwtPlainTextEngine. | | //! Draw the text as it is, using a QwtPlainTextEngine. | |
| PlainText, | | PlainText, | |
| | | | |
| //! Use the Scribe framework (Qt Rich Text) to render the text. | | //! Use the Scribe framework (Qt Rich Text) to render the text. | |
| | | | |
| skipping to change at line 170 | | skipping to change at line 172 | |
| QFont usedFont( const QFont & ) const; | | QFont usedFont( const QFont & ) const; | |
| | | | |
| void setRenderFlags( int flags ); | | void setRenderFlags( int flags ); | |
| int renderFlags() const; | | int renderFlags() const; | |
| | | | |
| void setColor( const QColor & ); | | void setColor( const QColor & ); | |
| QColor color() const; | | QColor color() const; | |
| | | | |
| QColor usedColor( const QColor & ) const; | | QColor usedColor( const QColor & ) const; | |
| | | | |
|
| void setBackgroundPen( const QPen & ); | | void setBorderRadius( double ); | |
| QPen backgroundPen() const; | | double borderRadius() const; | |
| | | | |
| | | void setBorderPen( const QPen & ); | |
| | | QPen borderPen() const; | |
| | | | |
| void setBackgroundBrush( const QBrush & ); | | void setBackgroundBrush( const QBrush & ); | |
| QBrush backgroundBrush() const; | | QBrush backgroundBrush() const; | |
| | | | |
| void setPaintAttribute( PaintAttribute, bool on = true ); | | void setPaintAttribute( PaintAttribute, bool on = true ); | |
| bool testPaintAttribute( PaintAttribute ) const; | | bool testPaintAttribute( PaintAttribute ) const; | |
| | | | |
| void setLayoutAttribute( LayoutAttribute, bool on = true ); | | void setLayoutAttribute( LayoutAttribute, bool on = true ); | |
| bool testLayoutAttribute( LayoutAttribute ) const; | | bool testLayoutAttribute( LayoutAttribute ) const; | |
| | | | |
| | | | |
| skipping to change at line 216 | | skipping to change at line 221 | |
| | | | |
| //! \return text().isEmpty() | | //! \return text().isEmpty() | |
| inline bool QwtText::isEmpty() const | | inline bool QwtText::isEmpty() const | |
| { | | { | |
| return text().isEmpty(); | | return text().isEmpty(); | |
| } | | } | |
| | | | |
| Q_DECLARE_OPERATORS_FOR_FLAGS( QwtText::PaintAttributes ) | | Q_DECLARE_OPERATORS_FOR_FLAGS( QwtText::PaintAttributes ) | |
| Q_DECLARE_OPERATORS_FOR_FLAGS( QwtText::LayoutAttributes ) | | Q_DECLARE_OPERATORS_FOR_FLAGS( QwtText::LayoutAttributes ) | |
| | | | |
|
| | | Q_DECLARE_METATYPE( QwtText ) | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 7 change blocks. |
| 6 lines changed or deleted | | 13 lines changed or added | |
|
| qwt_text_engine.h | | qwt_text_engine.h | |
| | | | |
| skipping to change at line 60 | | skipping to change at line 60 | |
| virtual double heightForWidth( const QFont &font, int flags, | | virtual double heightForWidth( const QFont &font, int flags, | |
| const QString &text, double width ) const = 0; | | const QString &text, double width ) const = 0; | |
| | | | |
| /*! | | /*! | |
| Returns the size, that is needed to render text | | Returns the size, that is needed to render text | |
| | | | |
| \param font Font of the text | | \param font Font of the text | |
| \param flags Bitwise OR of the flags like in for QPainter::drawText | | \param flags Bitwise OR of the flags like in for QPainter::drawText | |
| \param text Text to be rendered | | \param text Text to be rendered | |
| | | | |
|
| \return Caluclated size | | \return Calculated size | |
| */ | | */ | |
| virtual QSizeF textSize( const QFont &font, int flags, | | virtual QSizeF textSize( const QFont &font, int flags, | |
| const QString &text ) const = 0; | | const QString &text ) const = 0; | |
| | | | |
| /*! | | /*! | |
| Test if a string can be rendered by this text engine | | Test if a string can be rendered by this text engine | |
| | | | |
| \param text Text to be tested | | \param text Text to be tested | |
| \return true, if it can be rendered | | \return true, if it can be rendered | |
| */ | | */ | |
| virtual bool mightRender( const QString &text ) const = 0; | | virtual bool mightRender( const QString &text ) const = 0; | |
| | | | |
| /*! | | /*! | |
| Return margins around the texts | | Return margins around the texts | |
| | | | |
| The textSize might include margins around the | | The textSize might include margins around the | |
|
| text, like QFontMetrics::descent. In situations | | text, like QFontMetrics::descent(). In situations | |
| where texts need to be aligend in detail, knowing | | where texts need to be aligned in detail, knowing | |
| these margins might improve the layout calculations. | | these margins might improve the layout calculations. | |
| | | | |
| \param font Font of the text | | \param font Font of the text | |
| \param text Text to be rendered | | \param text Text to be rendered | |
| \param left Return value for the left margin | | \param left Return value for the left margin | |
| \param right Return value for the right margin | | \param right Return value for the right margin | |
| \param top Return value for the top margin | | \param top Return value for the top margin | |
| \param bottom Return value for the bottom margin | | \param bottom Return value for the bottom margin | |
| */ | | */ | |
| virtual void textMargins( const QFont &font, const QString &text, | | virtual void textMargins( const QFont &font, const QString &text, | |
| double &left, double &right, double &top, double &bottom ) const =
0; | | double &left, double &right, double &top, double &bottom ) const =
0; | |
| | | | |
| /*! | | /*! | |
| Draw the text in a clipping rectangle | | Draw the text in a clipping rectangle | |
| | | | |
| \param painter Painter | | \param painter Painter | |
| \param rect Clipping rectangle | | \param rect Clipping rectangle | |
|
| \param flags Bitwise OR of the flags like in for QPainter::drawText | | \param flags Bitwise OR of the flags like in for QPainter::drawText() | |
| \param text Text to be rendered | | \param text Text to be rendered | |
| */ | | */ | |
| virtual void draw( QPainter *painter, const QRectF &rect, | | virtual void draw( QPainter *painter, const QRectF &rect, | |
| int flags, const QString &text ) const = 0; | | int flags, const QString &text ) const = 0; | |
| | | | |
| protected: | | protected: | |
| QwtTextEngine(); | | QwtTextEngine(); | |
| }; | | }; | |
| | | | |
| /*! | | /*! | |
| | | | |
End of changes. 3 change blocks. |
| 4 lines changed or deleted | | 4 lines changed or added | |
|
| qwt_thermo.h | | qwt_thermo.h | |
| | | | |
| skipping to change at line 16 | | skipping to change at line 16 | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_THERMO_H | | #ifndef QWT_THERMO_H | |
| #define QWT_THERMO_H | | #define QWT_THERMO_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
| #include "qwt_abstract_scale.h" | | #include "qwt_abstract_scale.h" | |
| #include "qwt_interval.h" | | #include "qwt_interval.h" | |
|
| #include <qwidget.h> | | | |
| | | | |
| class QwtScaleDraw; | | class QwtScaleDraw; | |
| class QwtColorMap; | | class QwtColorMap; | |
| | | | |
| /*! | | /*! | |
| \brief The Thermometer Widget | | \brief The Thermometer Widget | |
| | | | |
| QwtThermo is a widget which displays a value in an interval. It supports: | | QwtThermo is a widget which displays a value in an interval. It supports: | |
| - a horizontal or vertical layout; | | - a horizontal or vertical layout; | |
| - a range; | | - a range; | |
| | | | |
| skipping to change at line 46 | | skipping to change at line 45 | |
| - QPalette::Base | | - QPalette::Base | |
| Background of the pipe | | Background of the pipe | |
| - QPalette::ButtonText | | - QPalette::ButtonText | |
| Fill brush below the alarm level | | Fill brush below the alarm level | |
| - QPalette::Highlight | | - QPalette::Highlight | |
| Fill brush for the values above the alarm level | | Fill brush for the values above the alarm level | |
| - QPalette::WindowText | | - QPalette::WindowText | |
| For the axis of the scale | | For the axis of the scale | |
| - QPalette::Text | | - QPalette::Text | |
| For the labels of the scale | | For the labels of the scale | |
|
| | | | |
| By default, the scale and range run over the same interval of values. | | | |
| QwtAbstractScale::setScale() changes the interval of the scale and allows | | | |
| easy conversion between physical units. | | | |
| | | | |
| The example shows how to make the scale indicate in degrees Fahrenheit an | | | |
| d | | | |
| to set the value in degrees Kelvin: | | | |
| \code | | | |
| #include <qapplication.h> | | | |
| #include <qwt_thermo.h> | | | |
| | | | |
| double Kelvin2Fahrenheit(double kelvin) | | | |
| { | | | |
| // see http://en.wikipedia.org/wiki/Kelvin | | | |
| return 1.8*kelvin - 459.67; | | | |
| } | | | |
| | | | |
| int main(int argc, char **argv) | | | |
| { | | | |
| const double minKelvin = 0.0; | | | |
| const double maxKelvin = 500.0; | | | |
| | | | |
| QApplication a(argc, argv); | | | |
| QwtThermo t; | | | |
| t.setRange(minKelvin, maxKelvin); | | | |
| t.setScale(Kelvin2Fahrenheit(minKelvin), Kelvin2Fahrenheit(maxKelvin)); | | | |
| // set the value in Kelvin but the scale displays in Fahrenheit | | | |
| // 273.15 Kelvin = 0 Celsius = 32 Fahrenheit | | | |
| t.setValue(273.15); | | | |
| a.setMainWidget(&t); | | | |
| t.show(); | | | |
| return a.exec(); | | | |
| } | | | |
| \endcode | | | |
| | | | |
| \todo Improve the support for a logarithmic range and/or scale. | | | |
| */ | | */ | |
|
| class QWT_EXPORT QwtThermo: public QWidget, public QwtAbstractScale | | class QWT_EXPORT QwtThermo: public QwtAbstractScale | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| | | | |
|
| Q_ENUMS( ScalePos ) | | Q_ENUMS( ScalePosition ) | |
| | | Q_ENUMS( OriginMode ) | |
| | | | |
| | | Q_PROPERTY( Qt::Orientation orientation | |
| | | READ orientation WRITE setOrientation ) | |
| | | Q_PROPERTY( ScalePosition scalePosition | |
| | | READ scalePosition WRITE setScalePosition ) | |
| | | Q_PROPERTY( OriginMode originMode READ originMode WRITE setOriginMode ) | |
| | | | |
| Q_PROPERTY( bool alarmEnabled READ alarmEnabled WRITE setAlarmEnabled ) | | Q_PROPERTY( bool alarmEnabled READ alarmEnabled WRITE setAlarmEnabled ) | |
| Q_PROPERTY( double alarmLevel READ alarmLevel WRITE setAlarmLevel ) | | Q_PROPERTY( double alarmLevel READ alarmLevel WRITE setAlarmLevel ) | |
|
| Q_PROPERTY( ScalePos scalePosition READ scalePosition | | Q_PROPERTY( double origin READ origin WRITE setOrigin ) | |
| WRITE setScalePosition ) | | | |
| Q_PROPERTY( int spacing READ spacing WRITE setSpacing ) | | Q_PROPERTY( int spacing READ spacing WRITE setSpacing ) | |
| Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth ) | | Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth ) | |
|
| Q_PROPERTY( double maxValue READ maxValue WRITE setMaxValue ) | | | |
| Q_PROPERTY( double minValue READ minValue WRITE setMinValue ) | | | |
| Q_PROPERTY( int pipeWidth READ pipeWidth WRITE setPipeWidth ) | | Q_PROPERTY( int pipeWidth READ pipeWidth WRITE setPipeWidth ) | |
| Q_PROPERTY( double value READ value WRITE setValue ) | | Q_PROPERTY( double value READ value WRITE setValue ) | |
| | | | |
| public: | | public: | |
|
| /*! | | | |
| Scale position. QwtThermo tries to enforce valid combinations of its | | | |
| orientation and scale position: | | | |
| | | | |
|
| - Qt::Horizonal combines with NoScale, TopScale and BottomScale | | /*! | |
| - Qt::Vertical combines with NoScale, LeftScale and RightScale | | Position of the scale | |
| | | \sa setScalePosition(), setOrientation() | |
| \sa setOrientation(), setScalePosition() | | */ | |
| */ | | enum ScalePosition | |
| enum ScalePos | | | |
| { | | { | |
|
| //! No scale | | //! The slider has no scale | |
| NoScale, | | NoScale, | |
| | | | |
|
| //! The scale is left of the pipe | | //! The scale is right of a vertical or below of a horizontal slide | |
| LeftScale, | | r | |
| | | LeadingScale, | |
| | | | |
|
| //! The scale is right of the pipe | | //! The scale is left of a vertical or above of a horizontal slider | |
| RightScale, | | TrailingScale | |
| | | }; | |
| | | | |
| | | /*! | |
| | | Origin mode. This property specifies where the beginning of the liqui | |
| | | d | |
| | | is placed. | |
| | | | |
| | | \sa setOriginMode(), setOrigin() | |
| | | */ | |
| | | enum OriginMode | |
| | | { | |
| | | //! The origin is the minimum of the scale | |
| | | OriginMinimum, | |
| | | | |
|
| //! The scale is above the pipe | | //! The origin is the maximum of the scale | |
| TopScale, | | OriginMaximum, | |
| | | | |
|
| //! The scale is below the pipe | | //! The origin is specified using the origin() property | |
| BottomScale | | OriginCustom | |
| }; | | }; | |
| | | | |
| explicit QwtThermo( QWidget *parent = NULL ); | | explicit QwtThermo( QWidget *parent = NULL ); | |
| virtual ~QwtThermo(); | | virtual ~QwtThermo(); | |
| | | | |
|
| void setOrientation( Qt::Orientation, ScalePos ); | | void setOrientation( Qt::Orientation ); | |
| | | Qt::Orientation orientation() const; | |
| | | | |
|
| void setScalePosition( ScalePos s ); | | void setScalePosition( ScalePosition ); | |
| ScalePos scalePosition() const; | | ScalePosition scalePosition() const; | |
| | | | |
| void setSpacing( int ); | | void setSpacing( int ); | |
| int spacing() const; | | int spacing() const; | |
| | | | |
| void setBorderWidth( int w ); | | void setBorderWidth( int w ); | |
| int borderWidth() const; | | int borderWidth() const; | |
| | | | |
|
| | | void setOriginMode( OriginMode ); | |
| | | OriginMode originMode() const; | |
| | | | |
| | | void setOrigin( double ); | |
| | | double origin() const; | |
| | | | |
| void setFillBrush( const QBrush &b ); | | void setFillBrush( const QBrush &b ); | |
|
| const QBrush &fillBrush() const; | | QBrush fillBrush() const; | |
| | | | |
| void setAlarmBrush( const QBrush &b ); | | void setAlarmBrush( const QBrush &b ); | |
|
| const QBrush &alarmBrush() const; | | QBrush alarmBrush() const; | |
| | | | |
| void setAlarmLevel( double v ); | | void setAlarmLevel( double v ); | |
| double alarmLevel() const; | | double alarmLevel() const; | |
| | | | |
| void setAlarmEnabled( bool tf ); | | void setAlarmEnabled( bool tf ); | |
| bool alarmEnabled() const; | | bool alarmEnabled() const; | |
| | | | |
| void setColorMap( QwtColorMap * ); | | void setColorMap( QwtColorMap * ); | |
| QwtColorMap *colorMap(); | | QwtColorMap *colorMap(); | |
| const QwtColorMap *colorMap() const; | | const QwtColorMap *colorMap() const; | |
| | | | |
| void setPipeWidth( int w ); | | void setPipeWidth( int w ); | |
| int pipeWidth() const; | | int pipeWidth() const; | |
| | | | |
| void setRangeFlags( QwtInterval::BorderFlags ); | | void setRangeFlags( QwtInterval::BorderFlags ); | |
| QwtInterval::BorderFlags rangeFlags() const; | | QwtInterval::BorderFlags rangeFlags() const; | |
| | | | |
|
| void setMaxValue( double v ); | | | |
| double maxValue() const; | | | |
| | | | |
| void setMinValue( double v ); | | | |
| double minValue() const; | | | |
| | | | |
| double value() const; | | double value() const; | |
| | | | |
|
| void setRange( double vmin, double vmax, bool lg = false ); | | | |
| | | | |
| virtual QSize sizeHint() const; | | virtual QSize sizeHint() const; | |
| virtual QSize minimumSizeHint() const; | | virtual QSize minimumSizeHint() const; | |
| | | | |
| void setScaleDraw( QwtScaleDraw * ); | | void setScaleDraw( QwtScaleDraw * ); | |
| const QwtScaleDraw *scaleDraw() const; | | const QwtScaleDraw *scaleDraw() const; | |
| | | | |
| public Q_SLOTS: | | public Q_SLOTS: | |
| virtual void setValue( double val ); | | virtual void setValue( double val ); | |
| | | | |
| protected: | | protected: | |
| virtual void drawLiquid( QPainter *, const QRect & ) const; | | virtual void drawLiquid( QPainter *, const QRect & ) const; | |
| virtual void scaleChange(); | | virtual void scaleChange(); | |
| | | | |
| virtual void paintEvent( QPaintEvent * ); | | virtual void paintEvent( QPaintEvent * ); | |
| virtual void resizeEvent( QResizeEvent * ); | | virtual void resizeEvent( QResizeEvent * ); | |
| virtual void changeEvent( QEvent * ); | | virtual void changeEvent( QEvent * ); | |
| | | | |
| QwtScaleDraw *scaleDraw(); | | QwtScaleDraw *scaleDraw(); | |
| | | | |
| QRect pipeRect() const; | | QRect pipeRect() const; | |
|
| | | QRect fillRect( const QRect & ) const; | |
| | | QRect alarmRect( const QRect & ) const; | |
| | | | |
| private: | | private: | |
| void layoutThermo( bool ); | | void layoutThermo( bool ); | |
| | | | |
| class PrivateData; | | class PrivateData; | |
| PrivateData *d_data; | | PrivateData *d_data; | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 21 change blocks. |
| 75 lines changed or deleted | | 52 lines changed or added | |
|
| qwt_wheel.h | | qwt_wheel.h | |
| | | | |
| skipping to change at line 14 | | skipping to change at line 14 | |
| * Copyright (C) 2002 Uwe Rathmann | | * Copyright (C) 2002 Uwe Rathmann | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the Qwt License, Version 1.0 | | * modify it under the terms of the Qwt License, Version 1.0 | |
| **************************************************************************
***/ | | **************************************************************************
***/ | |
| | | | |
| #ifndef QWT_WHEEL_H | | #ifndef QWT_WHEEL_H | |
| #define QWT_WHEEL_H | | #define QWT_WHEEL_H | |
| | | | |
| #include "qwt_global.h" | | #include "qwt_global.h" | |
|
| #include "qwt_abstract_slider.h" | | #include <qwidget.h> | |
| | | | |
| /*! | | /*! | |
| \brief The Wheel Widget | | \brief The Wheel Widget | |
| | | | |
| The wheel widget can be used to change values over a very large range | | The wheel widget can be used to change values over a very large range | |
|
| in very small steps. Using the setMass member, it can be configured | | in very small steps. Using the setMass() member, it can be configured | |
| as a flywheel. | | as a flying wheel. | |
| | | | |
| | | The default range of the wheel is [0.0, 100.0] | |
| | | | |
| \sa The radio example. | | \sa The radio example. | |
| */ | | */ | |
|
| class QWT_EXPORT QwtWheel : public QwtAbstractSlider | | class QWT_EXPORT QwtWheel: public QWidget | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| | | | |
|
| | | Q_PROPERTY( Qt::Orientation orientation | |
| | | READ orientation WRITE setOrientation ) | |
| | | | |
| | | Q_PROPERTY( double value READ value WRITE setValue ) | |
| | | Q_PROPERTY( double minimum READ minimum WRITE setMinimum ) | |
| | | Q_PROPERTY( double maximum READ maximum WRITE setMaximum ) | |
| | | | |
| | | Q_PROPERTY( double singleStep READ singleStep WRITE setSingleStep ) | |
| | | Q_PROPERTY( int pageStepCount READ pageStepCount WRITE setPageStepCount | |
| | | ) | |
| | | Q_PROPERTY( bool stepAlignment READ stepAlignment WRITE setStepAlignmen | |
| | | t ) | |
| | | | |
| | | Q_PROPERTY( bool tracking READ isTracking WRITE setTracking ) | |
| | | Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping ) | |
| | | Q_PROPERTY( bool inverted READ isInverted WRITE setInverted ) | |
| | | | |
| | | Q_PROPERTY( double mass READ mass WRITE setMass ) | |
| | | Q_PROPERTY( int updateInterval READ updateInterval WRITE setUpdateInter | |
| | | val ) | |
| | | | |
| Q_PROPERTY( double totalAngle READ totalAngle WRITE setTotalAngle ) | | Q_PROPERTY( double totalAngle READ totalAngle WRITE setTotalAngle ) | |
| Q_PROPERTY( double viewAngle READ viewAngle WRITE setViewAngle ) | | Q_PROPERTY( double viewAngle READ viewAngle WRITE setViewAngle ) | |
|
| Q_PROPERTY( int tickCnt READ tickCnt WRITE setTickCnt ) | | Q_PROPERTY( int tickCount READ tickCount WRITE setTickCount ) | |
| Q_PROPERTY( int wheelWidth READ wheelWidth WRITE setWheelWidth ) | | Q_PROPERTY( int wheelWidth READ wheelWidth WRITE setWheelWidth ) | |
| Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth ) | | Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth ) | |
| Q_PROPERTY( int wheelBorderWidth READ wheelBorderWidth WRITE setWheelBo
rderWidth ) | | Q_PROPERTY( int wheelBorderWidth READ wheelBorderWidth WRITE setWheelBo
rderWidth ) | |
|
| Q_PROPERTY( double mass READ mass WRITE setMass ) | | | |
| | | | |
| public: | | public: | |
| explicit QwtWheel( QWidget *parent = NULL ); | | explicit QwtWheel( QWidget *parent = NULL ); | |
| virtual ~QwtWheel(); | | virtual ~QwtWheel(); | |
| | | | |
|
| public Q_SLOTS: | | double value() const; | |
| void setTotalAngle ( double ); | | | |
| void setViewAngle( double ); | | | |
| | | | |
|
| public: | | void setOrientation( Qt::Orientation ); | |
| virtual void setOrientation( Qt::Orientation ); | | Qt::Orientation orientation() const; | |
| | | | |
| double totalAngle() const; | | double totalAngle() const; | |
| double viewAngle() const; | | double viewAngle() const; | |
| | | | |
|
| void setTickCnt( int ); | | void setTickCount( int ); | |
| int tickCnt() const; | | int tickCount() const; | |
| | | | |
| void setMass( double ); | | | |
| double mass() const; | | | |
| | | | |
| void setWheelWidth( int ); | | void setWheelWidth( int ); | |
| int wheelWidth() const; | | int wheelWidth() const; | |
| | | | |
| void setWheelBorderWidth( int ); | | void setWheelBorderWidth( int ); | |
| int wheelBorderWidth() const; | | int wheelBorderWidth() const; | |
| | | | |
| void setBorderWidth( int ); | | void setBorderWidth( int ); | |
| int borderWidth() const; | | int borderWidth() const; | |
| | | | |
|
| QRect wheelRect() const; | | void setInverted( bool tf ); | |
| | | bool isInverted() const; | |
| | | | |
|
| virtual QSize sizeHint() const; | | void setWrapping( bool tf ); | |
| virtual QSize minimumSizeHint() const; | | bool wrapping() const; | |
| | | | |
| | | void setSingleStep( double ); | |
| | | double singleStep() const; | |
| | | | |
| | | void setPageStepCount( int ); | |
| | | int pageStepCount() const; | |
| | | | |
| | | void setStepAlignment( bool on ); | |
| | | bool stepAlignment() const; | |
| | | | |
| | | void setRange( double vmin, double vmax ); | |
| | | | |
| | | void setMinimum( double min ); | |
| | | double minimum() const; | |
| | | | |
| | | void setMaximum( double max ); | |
| | | double maximum() const; | |
| | | | |
| | | void setUpdateInterval( int ); | |
| | | int updateInterval() const; | |
| | | | |
| | | void setTracking( bool enable ); | |
| | | bool isTracking() const; | |
| | | | |
| | | double mass() const; | |
| | | | |
| | | public Q_SLOTS: | |
| | | void setValue( double ); | |
| | | void setTotalAngle ( double ); | |
| | | void setViewAngle( double ); | |
| | | void setMass( double ); | |
| | | | |
| | | Q_SIGNALS: | |
| | | | |
| | | /*! | |
| | | \brief Notify a change of value. | |
| | | | |
| | | When tracking is enabled this signal will be emitted every | |
| | | time the value changes. | |
| | | | |
| | | \param value new value | |
| | | \sa setTracking() | |
| | | */ | |
| | | void valueChanged( double value ); | |
| | | | |
| | | /*! | |
| | | This signal is emitted when the user presses the | |
| | | the wheel with the mouse | |
| | | */ | |
| | | void wheelPressed(); | |
| | | | |
| | | /*! | |
| | | This signal is emitted when the user releases the mouse | |
| | | */ | |
| | | void wheelReleased(); | |
| | | | |
| | | /*! | |
| | | This signal is emitted when the user moves the | |
| | | wheel with the mouse. | |
| | | | |
| | | \param value new value | |
| | | */ | |
| | | void wheelMoved( double value ); | |
| | | | |
| protected: | | protected: | |
| virtual void paintEvent( QPaintEvent * ); | | virtual void paintEvent( QPaintEvent * ); | |
|
| virtual void resizeEvent( QResizeEvent * ); | | virtual void mousePressEvent( QMouseEvent * ); | |
| | | virtual void mouseReleaseEvent( QMouseEvent * ); | |
| | | virtual void mouseMoveEvent( QMouseEvent * ); | |
| | | virtual void keyPressEvent( QKeyEvent * ); | |
| | | virtual void wheelEvent( QWheelEvent * ); | |
| | | virtual void timerEvent( QTimerEvent * ); | |
| | | | |
| | | void stopFlying(); | |
| | | | |
| | | QRect wheelRect() const; | |
| | | | |
| | | virtual QSize sizeHint() const; | |
| | | virtual QSize minimumSizeHint() const; | |
| | | | |
| virtual void drawTicks( QPainter *, const QRectF & ); | | virtual void drawTicks( QPainter *, const QRectF & ); | |
| virtual void drawWheelBackground( QPainter *, const QRectF & ); | | virtual void drawWheelBackground( QPainter *, const QRectF & ); | |
| | | | |
|
| virtual void valueChange(); | | virtual double valueAt( const QPoint & ) const; | |
| | | | |
| virtual double getValue( const QPoint & ); | | | |
| virtual void getScrollMode( const QPoint &, | | | |
| QwtAbstractSlider::ScrollMode &, int &direction ) const; | | | |
| | | | |
| private: | | private: | |
|
| | | double alignedValue( double ) const; | |
| | | double boundedValue( double ) const; | |
| | | | |
| class PrivateData; | | class PrivateData; | |
| PrivateData *d_data; | | PrivateData *d_data; | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 14 change blocks. |
| 25 lines changed or deleted | | 117 lines changed or added | |
|