qwt_abstract_scale.h | qwt_abstract_scale.h | |||
---|---|---|---|---|
skipping to change at line 19 | skipping to change at line 19 | |||
#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" | |||
class QwtScaleEngine; | class QwtScaleEngine; | |||
class QwtAbstractScaleDraw; | class QwtAbstractScaleDraw; | |||
class QwtScaleDiv; | class QwtScaleDiv; | |||
class QwtScaleMap; | class QwtScaleMap; | |||
class QwtDoubleInterval; | class QwtInterval; | |||
/*! | /*! | |||
\brief An abstract base class for classes containing a scale | \brief An abstract base class for classes containing a scale | |||
QwtAbstractScale is used to provide classes with a QwtScaleDraw, | QwtAbstractScale is used to provide classes with a QwtScaleDraw, | |||
and a QwtScaleDiv. The QwtScaleDiv might be set explicitely | and a QwtScaleDiv. The QwtScaleDiv might be set explicitely | |||
or calculated by a QwtScaleEngine. | or calculated by a QwtScaleEngine. | |||
*/ | */ | |||
class QWT_EXPORT QwtAbstractScale | class QWT_EXPORT QwtAbstractScale | |||
{ | { | |||
public: | public: | |||
QwtAbstractScale(); | QwtAbstractScale(); | |||
virtual ~QwtAbstractScale(); | virtual ~QwtAbstractScale(); | |||
void setScale(double vmin, double vmax, double step = 0.0); | void setScale( double vmin, double vmax, double step = 0.0 ); | |||
void setScale(const QwtDoubleInterval &, double step = 0.0); | void setScale( const QwtInterval &, double step = 0.0 ); | |||
void setScale(const QwtScaleDiv &s); | void setScale( const QwtScaleDiv & ); | |||
void setAutoScale(); | void setAutoScale(); | |||
bool autoScale() const; | bool autoScale() 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(); | |||
const QwtScaleMap &scaleMap() const; | const QwtScaleMap &scaleMap() const; | |||
protected: | protected: | |||
void rescale(double vmin, double vmax, double step = 0.0); | void rescale( double vmin, double vmax, double step = 0.0 ); | |||
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. 7 change blocks. | ||||
9 lines changed or deleted | 9 lines changed or added | |||
qwt_abstract_scale_draw.h | qwt_abstract_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_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" | |||
#if QT_VERSION < 0x040000 | ||||
class QColorGroup; | ||||
#else | ||||
class QPalette; | class QPalette; | |||
#endif | ||||
class QPainter; | class QPainter; | |||
class QFont; | class QFont; | |||
class QwtScaleTransformation; | class QwtScaleTransformation; | |||
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 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 QwtAbstractScaleDraw | class QWT_EXPORT QwtAbstractScaleDraw | |||
{ | { | |||
public: | public: | |||
/*! | /*! | |||
Components of a scale | Components of a scale | |||
\sa enableComponent(), hasComponent | ||||
- Backbone | ||||
- Ticks | ||||
- Labels | ||||
\sa enableComponent(), hasComponent | ||||
*/ | */ | |||
enum ScaleComponent | enum ScaleComponent | |||
{ | { | |||
Backbone = 1, | //! Backbone = the line where the ticks are located | |||
Ticks = 2, | Backbone = 0x01, | |||
Labels = 4 | ||||
//! Ticks | ||||
Ticks = 0x02, | ||||
//! Labels | ||||
Labels = 0x04 | ||||
}; | }; | |||
//! Scale components | ||||
typedef QFlags<ScaleComponent> ScaleComponents; | ||||
QwtAbstractScaleDraw(); | QwtAbstractScaleDraw(); | |||
QwtAbstractScaleDraw( const QwtAbstractScaleDraw & ); | ||||
virtual ~QwtAbstractScaleDraw(); | virtual ~QwtAbstractScaleDraw(); | |||
QwtAbstractScaleDraw &operator=(const QwtAbstractScaleDraw &); | void setScaleDiv( const QwtScaleDiv &s ); | |||
void setScaleDiv(const QwtScaleDiv &s); | ||||
const QwtScaleDiv& scaleDiv() const; | const QwtScaleDiv& scaleDiv() const; | |||
void setTransformation(QwtScaleTransformation *); | void setTransformation( QwtScaleTransformation * ); | |||
const QwtScaleMap &map() const; | const QwtScaleMap &scaleMap() const; | |||
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, int length); | void setTickLength( QwtScaleDiv::TickType, double length ); | |||
int tickLength(QwtScaleDiv::TickType) const; | double tickLength( QwtScaleDiv::TickType ) const; | |||
int majTickLength() const; | double maxTickLength() const; | |||
void setSpacing(int margin); | void setSpacing( double margin ); | |||
int spacing() const; | double spacing() const; | |||
#if QT_VERSION < 0x040000 | void setPenWidth( int width ); | |||
virtual void draw(QPainter *, const QColorGroup &) const; | int penWidth() const; | |||
#else | ||||
virtual void draw(QPainter *, const QPalette &) const; | virtual void draw( QPainter *, const QPalette & ) const; | |||
#endif | ||||
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 distcance 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. | |||
\sa setMinimumExtent(), minimumExtent() | \sa setMinimumExtent(), minimumExtent() | |||
*/ | */ | |||
virtual int extent(const QPen &, const QFont &) const = 0; | virtual double extent( const QFont & ) const = 0; | |||
void setMinimumExtent(int); | void setMinimumExtent( double ); | |||
int minimumExtent() const; | double minimumExtent() const; | |||
QwtScaleMap &scaleMap(); | ||||
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 Lenght of the tick | |||
\sa drawBackbone(), drawLabel() | \sa drawBackbone(), drawLabel() | |||
*/ | */ | |||
virtual void drawTick(QPainter *painter, double value, int len) const = 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() | |||
*/ | */ | |||
virtual void drawBackbone(QPainter *painter) const = 0; | virtual void drawBackbone( QPainter *painter ) const = 0; | |||
/*! | /*! | |||
Draws the label for a major scale tick | Draws the label for a major scale tick | |||
\param painter Painter | \param painter Painter | |||
\param value Value | \param value Value | |||
\sa drawTick, drawBackbone | \sa drawTick(), drawBackbone() | |||
*/ | */ | |||
virtual void drawLabel(QPainter *painter, double value) const = 0; | virtual void drawLabel( QPainter *painter, double value ) const = 0; | |||
void invalidateCache(); | void invalidateCache(); | |||
const QwtText &tickLabel(const QFont &, double value) const; | const QwtText &tickLabel( const QFont &, double value ) const; | |||
private: | private: | |||
int operator==(const QwtAbstractScaleDraw &) const; | QwtAbstractScaleDraw( const QwtAbstractScaleDraw & ); | |||
int operator!=(const QwtAbstractScaleDraw &) const; | QwtAbstractScaleDraw &operator=( const QwtAbstractScaleDraw & ); | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtAbstractScaleDraw::ScaleComponents ); | ||||
#endif | #endif | |||
End of changes. 21 change blocks. | ||||
49 lines changed or deleted | 44 lines changed or added | |||
qwt_abstract_slider.h | qwt_abstract_slider.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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 <qwidget.h> | ||||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include "qwt_double_range.h" | #include "qwt_double_range.h" | |||
#include <qwidget.h> | ||||
/*! | /*! | |||
\brief An abstract base class for slider widgets | \brief An abstract base class for slider widgets | |||
QwtAbstractSlider is a base class for | QwtAbstractSlider is a base class for | |||
slider widgets. It handles mouse events | slider widgets. It handles mouse events | |||
and updates the slider's value accordingly. Derived classes | and updates the slider's value accordingly. Derived classes | |||
only have to implement the getValue() and | only have to implement the getValue() and | |||
getScrollMode() members, and should react to a | getScrollMode() members, and should react to a | |||
valueChange(), which normally requires repainting. | valueChange(), which normally requires repainting. | |||
*/ | */ | |||
class QWT_EXPORT QwtAbstractSlider : public QWidget, public QwtDoubleRange | class QWT_EXPORT QwtAbstractSlider : public QWidget, public QwtDoubleRange | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
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 valid READ isValid WRITE setValid ) | |||
Q_PROPERTY( double mass READ mass WRITE setMass ) | Q_PROPERTY( double mass READ mass WRITE setMass ) | |||
#ifndef Q_MOC_RUN // Qt3 moc | ||||
#define QWT_PROPERTY Q_PROPERTY | ||||
Q_PROPERTY( Orientation orientation | ||||
READ orientation WRITE setOrientation ) | ||||
#else // Qt4 moc | ||||
// MOC_SKIP_BEGIN | ||||
Q_PROPERTY( Qt::Orientation orientation | Q_PROPERTY( Qt::Orientation orientation | |||
READ orientation WRITE setOrientation ) | READ orientation WRITE setOrientation ) | |||
// MOC_SKIP_END | ||||
#endif | ||||
public: | public: | |||
/*! | /*! | |||
Scroll mode | Scroll mode | |||
\sa getScrollMode() | \sa getScrollMode() | |||
*/ | */ | |||
enum ScrollMode | enum ScrollMode | |||
{ | { | |||
//! Scrolling switched off. Don't change the value. | ||||
ScrNone, | ScrNone, | |||
/*! | ||||
Change the value while the user keeps the | ||||
button pressed and moves the mouse. | ||||
*/ | ||||
ScrMouse, | ScrMouse, | |||
/*! | ||||
Automatic scrolling. Increment the value in the specified directi | ||||
on | ||||
as long as the user keeps the button pressed. | ||||
*/ | ||||
ScrTimer, | ScrTimer, | |||
ScrDirect, | ScrDirect, | |||
//! Automatic scrolling. Same as ScrTimer, but increment by page si | ||||
ze. | ||||
ScrPage | ScrPage | |||
}; | }; | |||
explicit QwtAbstractSlider(Qt::Orientation, QWidget *parent = NULL); | explicit QwtAbstractSlider( Qt::Orientation, QWidget *parent = NULL ); | |||
virtual ~QwtAbstractSlider(); | virtual ~QwtAbstractSlider(); | |||
void setUpdateTime(int t); | void setUpdateTime( int t ); | |||
void stopMoving(); | void stopMoving(); | |||
void setTracking(bool enable); | void setTracking( bool enable ); | |||
virtual void setMass(double val); | virtual void setMass( double val ); | |||
virtual double mass() const; | virtual double mass() const; | |||
#if QT_VERSION >= 0x040000 | virtual void setOrientation( Qt::Orientation o ); | |||
virtual void setOrientation(Qt::Orientation o); | ||||
Qt::Orientation orientation() const; | Qt::Orientation orientation() const; | |||
#else | ||||
virtual void setOrientation(Orientation o); | ||||
Orientation orientation() const; | ||||
#endif | ||||
bool isReadOnly() const; | bool isReadOnly() const; | |||
/* | /* | |||
Wrappers for QwtDblRange::isValid/QwtDblRange::setValid made | Wrappers for QwtDblRange::isValid/QwtDblRange::setValid made | |||
to be available as Q_PROPERTY in the designer. | to be available as Q_PROPERTY in the designer. | |||
*/ | */ | |||
/*! | /*! | |||
\sa QwtDblRange::isValid() | \sa QwtDblRange::isValid() | |||
*/ | */ | |||
bool isValid() const { return QwtDoubleRange::isValid(); } | bool isValid() const | |||
{ | ||||
return QwtDoubleRange::isValid(); | ||||
} | ||||
/*! | /*! | |||
\param valid true/false | \param valid true/false | |||
\sa QwtDblRange::isValid() | \sa QwtDblRange::isValid() | |||
*/ | */ | |||
void setValid(bool valid) { QwtDoubleRange::setValid(valid); } | void setValid( bool valid ) | |||
{ | ||||
QwtDoubleRange::setValid( valid ); | ||||
} | ||||
public slots: | public Q_SLOTS: | |||
virtual void setValue(double val); | virtual void setValue( double val ); | |||
virtual void fitValue(double val); | virtual void fitValue( double val ); | |||
virtual void incValue(int steps); | virtual void incValue( int steps ); | |||
virtual void setReadOnly(bool); | virtual void setReadOnly( bool ); | |||
signals: | Q_SIGNALS: | |||
/*! | /*! | |||
\brief Notify a change of value. | \brief Notify a change of value. | |||
In the default setting | In the default setting | |||
(tracking enabled), this signal will be emitted every | (tracking enabled), this signal will be emitted every | |||
time the value changes ( see setTracking() ). | time the value changes ( see setTracking() ). | |||
\param value new value | \param value new value | |||
*/ | */ | |||
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 (start ScrMouse Mode). | |||
*/ | */ | |||
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 | |||
*/ | */ | |||
void sliderMoved(double value); | void sliderMoved( double value ); | |||
protected: | protected: | |||
virtual void setPosition(const QPoint &); | virtual void setPosition( const QPoint & ); | |||
virtual void valueChange(); | virtual void valueChange(); | |||
virtual void timerEvent(QTimerEvent *e); | virtual void timerEvent( QTimerEvent *e ); | |||
virtual void mousePressEvent(QMouseEvent *e); | virtual void mousePressEvent( QMouseEvent *e ); | |||
virtual void mouseReleaseEvent(QMouseEvent *e); | virtual void mouseReleaseEvent( QMouseEvent *e ); | |||
virtual void mouseMoveEvent(QMouseEvent *e); | virtual void mouseMoveEvent( QMouseEvent *e ); | |||
virtual void keyPressEvent(QKeyEvent *e); | virtual void keyPressEvent( QKeyEvent *e ); | |||
virtual void wheelEvent(QWheelEvent *e); | virtual void wheelEvent( QWheelEvent *e ); | |||
/*! | /*! | |||
\brief Determine the value corresponding to a specified poind | \brief Determine the value corresponding to a specified poind | |||
This is an abstract virtual function which is called when | This is an abstract virtual function which is called when | |||
the user presses or releases a mouse button or moves the | the user presses or releases a mouse button or moves the | |||
mouse. It has to be implemented by the derived class. | mouse. It has to be implemented by the derived class. | |||
\param p point | \param p point | |||
*/ | */ | |||
virtual double getValue(const QPoint & p) = 0; | virtual double getValue( const QPoint & p ) = 0; | |||
/*! | ||||
\brief Determine what to do when the user presses a mouse button. | /*! | |||
\brief Determine what to do when the user presses a mouse button. | ||||
This function is abstract and has to be implemented by derived classes. | ||||
It is called on a mousePress event. The derived class can determine | This function is abstract and has to be implemented by derived classe | |||
what should happen next in dependence of the position where the mouse | s. | |||
was pressed by returning scrolling mode and direction. QwtAbstractSlide | It is called on a mousePress event. The derived class can determine | |||
r | what should happen next in dependence of the position where the mouse | |||
knows the following modes:<dl> | was pressed by returning scrolling mode and direction. | |||
<dt>QwtAbstractSlider::ScrNone | ||||
<dd>Scrolling switched off. Don't change the value. | \param pos point where the mouse was pressed | |||
<dt>QwtAbstractSlider::ScrMouse | \retval scrollMode The scrolling mode | |||
<dd>Change the value while the user keeps the | \retval direction direction: 1, 0, or -1. | |||
button pressed and moves the mouse. | */ | |||
<dt>QwtAbstractSlider::ScrTimer | virtual void getScrollMode( const QPoint &pos, | |||
<dd>Automatic scrolling. Increment the value | ScrollMode &scrollMode, int &direction ) const = 0; | |||
in the specified direction as long as | ||||
the user keeps the button pressed. | ||||
<dt>QwtAbstractSlider::ScrPage | ||||
<dd>Automatic scrolling. Same as ScrTimer, but | ||||
increment by page size.</dl> | ||||
\param p point where the mouse was pressed | ||||
\retval scrollMode The scrolling mode | ||||
\retval direction direction: 1, 0, or -1. | ||||
*/ | ||||
virtual void getScrollMode( const QPoint &p, | ||||
int &scrollMode, int &direction) = 0; | ||||
void setMouseOffset(double); | void setMouseOffset( double ); | |||
double mouseOffset() const; | double mouseOffset() const; | |||
int scrollMode() const; | int scrollMode() const; | |||
private: | private: | |||
void buttonReleased(); | void buttonReleased(); | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
End of changes. 25 change blocks. | ||||
76 lines changed or deleted | 73 lines changed or added | |||
qwt_analog_clock.h | qwt_analog_clock.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_ANALOG_CLOCK_H | #ifndef QWT_ANALOG_CLOCK_H | |||
#define QWT_ANALOG_CLOCK_H | #define QWT_ANALOG_CLOCK_H | |||
#include <qdatetime.h> | ||||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include "qwt_dial.h" | #include "qwt_dial.h" | |||
#include "qwt_dial_needle.h" | #include "qwt_dial_needle.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> | \verbatim #include <qwt_analog_clock.h> | |||
QwtAnalogClock *clock = new QwtAnalogClock(...); | QwtAnalogClock *clock = new QwtAnalogClock(...); | |||
skipping to change at line 54 | skipping to change at line 54 | |||
class QWT_EXPORT QwtAnalogClock: public QwtDial | class QWT_EXPORT QwtAnalogClock: public QwtDial | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
/*! | /*! | |||
Hand type | Hand type | |||
\sa setHand(), hand() | \sa setHand(), hand() | |||
*/ | */ | |||
enum Hand | enum Hand | |||
{ | { | |||
//! Needle displaying the seconds | ||||
SecondHand, | SecondHand, | |||
//! Needle displaying the minutes | ||||
MinuteHand, | MinuteHand, | |||
//! Needle displaying the hours | ||||
HourHand, | HourHand, | |||
//! Number of needles | ||||
NHands | NHands | |||
}; | }; | |||
explicit QwtAnalogClock(QWidget* parent = NULL); | explicit QwtAnalogClock( QWidget* parent = NULL ); | |||
#if QT_VERSION < 0x040000 | ||||
explicit QwtAnalogClock(QWidget* parent, const char *name); | ||||
#endif | ||||
virtual ~QwtAnalogClock(); | virtual ~QwtAnalogClock(); | |||
virtual void setHand(Hand, QwtDialNeedle *); | virtual void setHand( Hand, QwtDialNeedle * ); | |||
const QwtDialNeedle *hand(Hand) const; | const QwtDialNeedle *hand( Hand ) const; | |||
QwtDialNeedle *hand(Hand); | QwtDialNeedle *hand( Hand ); | |||
public slots: | public Q_SLOTS: | |||
void setCurrentTime(); | void setCurrentTime(); | |||
void setTime(const QTime & = QTime::currentTime()); | void setTime( const QTime & = QTime::currentTime() ); | |||
protected: | protected: | |||
virtual QwtText scaleLabel(double) const; | virtual QwtText scaleLabel( double ) const; | |||
virtual void drawNeedle(QPainter *, const QPoint &, | virtual void drawNeedle( QPainter *, const QPointF &, | |||
int radius, double direction, QPalette::ColorGroup) const; | double radius, double direction, QPalette::ColorGroup ) const; | |||
virtual void drawHand(QPainter *, Hand, const QPoint &, | virtual void drawHand( QPainter *, Hand, const QPointF &, | |||
int radius, double direction, QPalette::ColorGroup) const; | double radius, double direction, QPalette::ColorGroup ) const; | |||
private: | private: | |||
virtual void setNeedle(QwtDialNeedle *); | virtual void setNeedle( QwtDialNeedle * ); | |||
void initClock(); | void initClock(); | |||
QwtDialNeedle *d_hand[NHands]; | QwtDialNeedle *d_hand[NHands]; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 15 change blocks. | ||||
17 lines changed or deleted | 19 lines changed or added | |||
qwt_arrow_button.h | qwt_arrow_button.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_ARROW_BUTTON_H | #ifndef QWT_ARROW_BUTTON_H | |||
#define QWT_ARROW_BUTTON_H | #define QWT_ARROW_BUTTON_H | |||
#include <qpushbutton.h> | ||||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include <qpushbutton.h> | ||||
/*! | /*! | |||
\brief Arrow Button | \brief Arrow Button | |||
A push button with one or more filled triangles on its front. | A push button with one or more filled triangles on its front. | |||
An Arrow button can have 1 to 3 arrows in a row, pointing | An Arrow button can have 1 to 3 arrows in a row, pointing | |||
up, down, left or right. | up, down, left or right. | |||
*/ | */ | |||
class QWT_EXPORT QwtArrowButton : public QPushButton | class QWT_EXPORT QwtArrowButton : public QPushButton | |||
{ | { | |||
public: | public: | |||
explicit QwtArrowButton (int num, Qt::ArrowType, QWidget *parent = NULL ); | explicit QwtArrowButton ( int num, Qt::ArrowType, QWidget *parent = NUL L ); | |||
virtual ~QwtArrowButton(); | virtual ~QwtArrowButton(); | |||
Qt::ArrowType arrowType() const; | Qt::ArrowType arrowType() const; | |||
int num() const; | int num() const; | |||
virtual QSize sizeHint() const; | virtual QSize sizeHint() const; | |||
virtual QSize minimumSizeHint() const; | virtual QSize minimumSizeHint() const; | |||
protected: | protected: | |||
#if QT_VERSION >= 0x040000 | virtual void paintEvent( QPaintEvent *event ); | |||
virtual void paintEvent(QPaintEvent *event); | ||||
#endif | ||||
virtual void drawButtonLabel(QPainter *p); | virtual void drawButtonLabel( QPainter *p ); | |||
virtual void drawArrow(QPainter *, | virtual void drawArrow( QPainter *, | |||
const QRect &, Qt::ArrowType) const; | const QRect &, Qt::ArrowType ) const; | |||
virtual QRect labelRect() const; | virtual QRect labelRect() const; | |||
virtual QSize arrowSize(Qt::ArrowType, | virtual QSize arrowSize( Qt::ArrowType, | |||
const QSize &boundingSize) const; | const QSize &boundingSize ) const; | |||
virtual void keyPressEvent(QKeyEvent *); | virtual void keyPressEvent( QKeyEvent * ); | |||
private: | private: | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 7 change blocks. | ||||
11 lines changed or deleted | 9 lines changed or added | |||
qwt_clipper.h | qwt_clipper.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_CLIPPER_H | #ifndef QWT_CLIPPER_H | |||
#define QWT_CLIPPER_H | #define QWT_CLIPPER_H | |||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include "qwt_array.h" | #include "qwt_interval.h" | |||
#include "qwt_polygon.h" | #include <qpolygon.h> | |||
#include "qwt_double_rect.h" | #include <qvector.h> | |||
#include "qwt_double_interval.h" | ||||
class QRect; | class QRect; | |||
class QRectF; | ||||
/*! | /*! | |||
\brief Some clipping algos | \brief Some clipping algos | |||
*/ | */ | |||
class QWT_EXPORT QwtClipper | class QWT_EXPORT QwtClipper | |||
{ | { | |||
public: | public: | |||
static QwtPolygon clipPolygon(const QRect &, const QwtPolygon &); | static QPolygon clipPolygon( const QRect &, | |||
static QwtPolygonF clipPolygonF(const QwtDoubleRect &, const QwtPolygon | const QPolygon &, bool closePolygon = false ); | |||
F &); | static QPolygonF clipPolygonF( const QRectF &, | |||
const QPolygonF &, bool closePolygon = false ); | ||||
#if QT_VERSION >= 0x040000 | static QVector<QwtInterval> clipCircle( | |||
static QwtArray<QwtDoubleInterval> clipCircle( | const QRectF &, const QPointF &, double radius ); | |||
const QwtDoubleRect &, const QwtDoublePoint &, double radius); | ||||
#endif | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
11 lines changed or deleted | 10 lines changed or added | |||
qwt_color_map.h | qwt_color_map.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_COLOR_MAP_H | #ifndef QWT_COLOR_MAP_H | |||
#define QWT_COLOR_MAP_H | #define QWT_COLOR_MAP_H | |||
#include <qglobal.h> | #include "qwt_global.h" | |||
#include "qwt_interval.h" | ||||
#include <qcolor.h> | #include <qcolor.h> | |||
#if QT_VERSION < 0x040000 | ||||
#include <qvaluevector.h> | ||||
#else | ||||
#include <qvector.h> | #include <qvector.h> | |||
#endif | ||||
#include "qwt_array.h" | ||||
#include "qwt_double_interval.h" | ||||
#if defined(QWT_TEMPLATEDLL) | ||||
// MOC_SKIP_BEGIN | ||||
template class QWT_EXPORT QwtArray<double>; | ||||
// MOC_SKIP_END | ||||
#endif | ||||
/*! | /*! | |||
\brief QwtColorMap is used to map values into colors. | \brief QwtColorMap is used to map values into colors. | |||
For displaying 3D data on a 2D plane the 3rd dimension is often | For displaying 3D data on a 2D plane the 3rd dimension is often | |||
displayed using colors, like f.e in a spectrogram. | displayed using colors, like f.e in a spectrogram. | |||
Each color map is optimized to return colors for only one of the | Each color map is optimized to return colors for only one of the | |||
following image formats: | following image formats: | |||
- QImage::Format_Indexed8\n | - QImage::Format_Indexed8\n | |||
- QImage::Format_ARGB32\n | - QImage::Format_ARGB32\n | |||
\sa QwtPlotSpectrogram, QwtScaleWidget | \sa QwtPlotSpectrogram, QwtScaleWidget | |||
*/ | */ | |||
class QWT_EXPORT QwtColorMap | class QWT_EXPORT QwtColorMap | |||
{ | { | |||
public: | public: | |||
/*! | /*! | |||
- RGB\n | Format for color mapping | |||
The map is intended to map into QRgb values. | ||||
- Indexed\n | ||||
The map is intended to map into 8 bit values, that | ||||
are indices into the color table. | ||||
\sa rgb(), colorIndex(), colorTable() | \sa rgb(), colorIndex(), colorTable() | |||
*/ | */ | |||
enum Format | enum Format | |||
{ | { | |||
//! The map is intended to map into QRgb values. | ||||
RGB, | RGB, | |||
/*! | ||||
The map is intended to map into 8 bit values, that | ||||
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; | |||
//! Clone the color map | ||||
virtual QwtColorMap *copy() const = 0; | ||||
/*! | /*! | |||
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( | virtual QRgb rgb( const QwtInterval &interval, | |||
const QwtDoubleInterval &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 QwtDoubleInterval &interval, double value) const = 0; | const QwtInterval &interval, double value ) const = 0; | |||
QColor color(const QwtDoubleInterval &, double value) const; | QColor color( const QwtInterval &, double value ) const; | |||
#if QT_VERSION < 0x040000 | virtual QVector<QRgb> colorTable( const QwtInterval & ) const; | |||
virtual QValueVector<QRgb> colorTable(const QwtDoubleInterval &) const; | ||||
#else | ||||
virtual QVector<QRgb> colorTable(const QwtDoubleInterval &) const; | ||||
#endif | ||||
private: | private: | |||
Format d_format; | Format d_format; | |||
}; | }; | |||
/*! | /*! | |||
\brief QwtLinearColorMap builds a color map from color stops. | \brief QwtLinearColorMap builds a color map from color stops. | |||
A color stop is a color at a specific position. The valid | A color stop is a color at a specific position. The valid | |||
range for the positions is [0.0, 1.0]. When mapping a value | range for the positions is [0.0, 1.0]. When mapping a value | |||
into a color it is translated into this interval. If | into a color it is translated into this interval according to mode(). | |||
mode() == FixedColors the color is calculated from the next lower | ||||
color stop. If mode() == ScaledColors the color is calculated | ||||
by interpolating the colors of the adjacent stops. | ||||
*/ | */ | |||
class QWT_EXPORT QwtLinearColorMap: public QwtColorMap | class QWT_EXPORT QwtLinearColorMap: public QwtColorMap | |||
{ | { | |||
public: | public: | |||
/*! | /*! | |||
Mode of color map | Mode of color map | |||
\sa setMode(), mode() | \sa setMode(), mode() | |||
*/ | */ | |||
enum Mode | enum Mode | |||
{ | { | |||
//! Return the color from the next lower color stop | ||||
FixedColors, | FixedColors, | |||
//! Interpolating the colors of the adjacent stops. | ||||
ScaledColors | ScaledColors | |||
}; | }; | |||
QwtLinearColorMap(QwtColorMap::Format = QwtColorMap::RGB); | QwtLinearColorMap( QwtColorMap::Format = QwtColorMap::RGB ); | |||
QwtLinearColorMap( const QColor &from, const QColor &to, | QwtLinearColorMap( const QColor &from, const QColor &to, | |||
QwtColorMap::Format = QwtColorMap::RGB); | QwtColorMap::Format = QwtColorMap::RGB ); | |||
QwtLinearColorMap(const QwtLinearColorMap &); | ||||
virtual ~QwtLinearColorMap(); | virtual ~QwtLinearColorMap(); | |||
QwtLinearColorMap &operator=(const QwtLinearColorMap &); | void setMode( Mode ); | |||
virtual QwtColorMap *copy() const; | ||||
void setMode(Mode); | ||||
Mode mode() const; | Mode mode() const; | |||
void setColorInterval(const QColor &color1, const QColor &color2); | void setColorInterval( const QColor &color1, const QColor &color2 ); | |||
void addColorStop(double value, const QColor&); | void addColorStop( double value, const QColor& ); | |||
QwtArray<double> colorStops() const; | QVector<double> colorStops() const; | |||
QColor color1() const; | QColor color1() const; | |||
QColor color2() const; | QColor color2() const; | |||
virtual QRgb rgb(const QwtDoubleInterval &, double value) const; | virtual QRgb rgb( const QwtInterval &, double value ) const; | |||
virtual unsigned char colorIndex( | virtual unsigned char colorIndex( | |||
const QwtDoubleInterval &, double value) const; | const QwtInterval &, double value ) const; | |||
class ColorStops; | class ColorStops; | |||
private: | private: | |||
// Disabled copy constructor and operator= | ||||
QwtLinearColorMap( 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 variies 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 ) ); | |||
QwtAlphaColorMap(const QwtAlphaColorMap &); | ||||
virtual ~QwtAlphaColorMap(); | virtual ~QwtAlphaColorMap(); | |||
QwtAlphaColorMap &operator=(const QwtAlphaColorMap &); | void setColor( const QColor & ); | |||
virtual QwtColorMap *copy() const; | ||||
void setColor(const QColor &); | ||||
QColor color() const; | QColor color() const; | |||
virtual QRgb rgb(const QwtDoubleInterval &, double value) const; | virtual QRgb rgb( const QwtInterval &, double value ) const; | |||
private: | private: | |||
QwtAlphaColorMap( const QwtAlphaColorMap & ); | ||||
QwtAlphaColorMap &operator=( const QwtAlphaColorMap & ); | ||||
virtual unsigned char colorIndex( | virtual unsigned char colorIndex( | |||
const QwtDoubleInterval &, double value) const; | const QwtInterval &, double value ) const; | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
/*! | /*! | |||
Map a value into a color | Map a value into a color | |||
\param interval Valid interval for values | \param interval Valid interval for values | |||
\param value Value | \param value Value | |||
\return Color corresponding to value | \return Color corresponding to value | |||
\warning This method is slow for Indexed color maps. If it is | \warning This method is slow for Indexed color maps. If it is | |||
necessary to map many values, its better to get the | necessary to map many values, its better to get the | |||
color table once and find the color using colorIndex(). | color table once and find the color using colorIndex(). | |||
*/ | */ | |||
inline QColor QwtColorMap::color( | inline QColor QwtColorMap::color( | |||
const QwtDoubleInterval &interval, double value) const | const QwtInterval &interval, double value ) const | |||
{ | { | |||
if ( d_format == RGB ) | if ( d_format == RGB ) | |||
{ | { | |||
return QColor( rgb(interval, value) ); | return QColor( rgb( interval, value ) ); | |||
} | } | |||
else | else | |||
{ | { | |||
const unsigned int index = colorIndex(interval, value); | const unsigned int index = colorIndex( interval, value ); | |||
return colorTable(interval)[index]; // slow | return colorTable( interval )[index]; // slow | |||
} | } | |||
} | } | |||
/*! | /*! | |||
\return Intended format of the color map | \return Intended format of the color map | |||
\sa Format | \sa Format | |||
*/ | */ | |||
inline QwtColorMap::Format QwtColorMap::format() const | inline QwtColorMap::Format QwtColorMap::format() const | |||
{ | { | |||
return d_format; | return d_format; | |||
End of changes. 29 change blocks. | ||||
64 lines changed or deleted | 42 lines changed or added | |||
qwt_compass.h | qwt_compass.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_COMPASS_H | #ifndef QWT_COMPASS_H | |||
#define QWT_COMPASS_H 1 | #define QWT_COMPASS_H 1 | |||
#include "qwt_global.h" | ||||
#include "qwt_dial.h" | ||||
#include <qstring.h> | #include <qstring.h> | |||
#include <qmap.h> | #include <qmap.h> | |||
#include "qwt_dial.h" | ||||
#if defined(QWT_TEMPLATEDLL) | ||||
#if defined(QT_NO_STL) || QT_VERSION < 0x040000 || QT_VERSION > 0x040001 | ||||
/* | ||||
Unfortunately Qt 4.0.0/Qt 4.0.1 contains uncompilable | ||||
code in the STL adaptors of qmap.h. The declaration below | ||||
instantiates this code resulting in compiler errors. | ||||
If you really need the map to be exported, remove the condition above | ||||
and fix the qmap.h | ||||
*/ | ||||
// MOC_SKIP_BEGIN | ||||
template class QWT_EXPORT QMap<double, QString>; | ||||
// MOC_SKIP_END | ||||
#endif | ||||
#endif | ||||
class QwtCompassRose; | class QwtCompassRose; | |||
/*! | /*! | |||
\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. | |||
*/ | */ | |||
class QWT_EXPORT QwtCompass: public QwtDial | class QWT_EXPORT QwtCompass: public QwtDial | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
explicit QwtCompass( QWidget* parent = NULL); | explicit QwtCompass( QWidget* parent = NULL ); | |||
#if QT_VERSION < 0x040000 | ||||
explicit QwtCompass(QWidget* parent, const char *name); | ||||
#endif | ||||
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; | const QMap<double, QString> &labelMap() const; | |||
QMap<double, QString> &labelMap(); | QMap<double, QString> &labelMap(); | |||
void setLabelMap(const QMap<double, QString> &map); | void setLabelMap( const QMap<double, QString> &map ); | |||
protected: | protected: | |||
virtual QwtText scaleLabel(double value) const; | virtual QwtText scaleLabel( double value ) const; | |||
virtual void drawRose(QPainter *, const QPoint ¢er, | virtual void drawRose( QPainter *, const QPointF ¢er, | |||
int radius, double north, QPalette::ColorGroup) const; | double radius, double north, QPalette::ColorGroup ) const; | |||
virtual void drawScaleContents(QPainter *, | virtual void drawScaleContents( QPainter *, | |||
const QPoint ¢er, int radius) const; | const QPointF ¢er, double radius ) const; | |||
virtual void keyPressEvent(QKeyEvent *); | virtual void keyPressEvent( QKeyEvent * ); | |||
private: | private: | |||
void initCompass(); | void initCompass(); | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 9 change blocks. | ||||
30 lines changed or deleted | 11 lines changed or added | |||
qwt_compass_rose.h | qwt_compass_rose.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_COMPASS_ROSE_H | #ifndef QWT_COMPASS_ROSE_H | |||
#define QWT_COMPASS_ROSE_H 1 | #define QWT_COMPASS_ROSE_H 1 | |||
#include <qpalette.h> | ||||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include <qpalette.h> | ||||
class QPainter; | class QPainter; | |||
/*! | /*! | |||
\brief Abstract base class for a compass rose | \brief Abstract base class for a compass rose | |||
*/ | */ | |||
class QWT_EXPORT QwtCompassRose | class QWT_EXPORT QwtCompassRose | |||
{ | { | |||
public: | public: | |||
//! Destructor | ||||
virtual ~QwtCompassRose() {}; | virtual ~QwtCompassRose() {}; | |||
//! Assign a palette | //! Assign a palette | |||
virtual void setPalette(const QPalette &p) { d_palette = p; } | virtual void setPalette( const QPalette &p ) | |||
{ | ||||
d_palette = p; | ||||
} | ||||
//! \return Current palette | //! \return Current palette | |||
const QPalette &palette() const { return d_palette; } | const QPalette &palette() const | |||
{ | ||||
return d_palette; | ||||
} | ||||
/*! | /*! | |||
Draw the rose | Draw the rose | |||
\param painter Painter | \param painter Painter | |||
\param center Center point | \param center Center point | |||
\param radius Radius of the rose | \param radius Radius of the rose | |||
\param north Position | \param north Position | |||
\param colorGroup Color group | \param colorGroup Color group | |||
*/ | */ | |||
virtual void draw(QPainter *painter, const QPoint ¢er, | virtual void draw( QPainter *painter, | |||
int radius, double north, | const QPointF ¢er, double radius, double north, | |||
QPalette::ColorGroup colorGroup = QPalette::Active) const = 0; | QPalette::ColorGroup colorGroup = QPalette::Active ) const = 0; | |||
private: | private: | |||
QPalette d_palette; | QPalette d_palette; | |||
}; | }; | |||
/*! | /*! | |||
\brief A simple rose for QwtCompass | \brief A simple rose for QwtCompass | |||
*/ | */ | |||
class QWT_EXPORT QwtSimpleCompassRose: public QwtCompassRose | class QWT_EXPORT QwtSimpleCompassRose: public QwtCompassRose | |||
{ | { | |||
public: | public: | |||
QwtSimpleCompassRose(int numThorns = 8, int numThornLevels = -1); | QwtSimpleCompassRose( int numThorns = 8, int numThornLevels = -1 ); | |||
virtual ~QwtSimpleCompassRose(); | ||||
void setWidth(double w); | ||||
//! \sa setWidth() | void setWidth( double w ); | |||
double width() const { return d_width; } | double width() const; | |||
void setNumThorns(int count); | void setNumThorns( int count ); | |||
int numThorns() const; | int numThorns() const; | |||
void setNumThornLevels(int count); | void setNumThornLevels( int count ); | |||
int numThornLevels() const; | int numThornLevels() const; | |||
void setShrinkFactor(double factor) { d_shrinkFactor = factor; } | void setShrinkFactor( double factor ); | |||
double shrinkFactor() const { return d_shrinkFactor; } | double shrinkFactor() const; | |||
virtual void draw(QPainter *, const QPoint ¢er, int radius, | virtual void draw( QPainter *, const QPointF ¢er, double radius, | |||
double north, QPalette::ColorGroup = QPalette::Active) const; | double north, QPalette::ColorGroup = QPalette::Active ) const; | |||
static void drawRose(QPainter *, | static void drawRose( QPainter *, const QPalette &, | |||
#if QT_VERSION < 0x040000 | const QPointF ¢er, double radius, double origin, double width, | |||
const QColorGroup &, | int numThorns, int numThornLevels, double shrinkFactor ); | |||
#else | ||||
const QPalette &, | ||||
#endif | ||||
const QPoint ¢er, int radius, double origin, double width, | ||||
int numThorns, int numThornLevels, double shrinkFactor); | ||||
private: | private: | |||
double d_width; | class PrivateData; | |||
int d_numThorns; | PrivateData *d_data; | |||
int d_numThornLevels; | ||||
double d_shrinkFactor; | ||||
}; | }; | |||
#endif // QWT_COMPASS_ROSE_H | #endif | |||
End of changes. 15 change blocks. | ||||
29 lines changed or deleted | 28 lines changed or added | |||
qwt_counter.h | qwt_counter.h | |||
---|---|---|---|---|
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | |||
* Qwt Widget Library | * Qwt Widget Library | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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 | |||
************************************************************************** ***/ | ************************************************************************** ***/ | |||
// vim: expandtab | ||||
#ifndef QWT_COUNTER_H | #ifndef QWT_COUNTER_H | |||
#define QWT_COUNTER_H | #define QWT_COUNTER_H | |||
#include <qwidget.h> | ||||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include "qwt_double_range.h" | #include "qwt_double_range.h" | |||
#include <qwidget.h> | ||||
/*! | /*! | |||
\brief The Counter Widget | \brief The Counter Widget | |||
A Counter consists of a label 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 label 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 | |||
skipping to change at line 66 | skipping to change at line 64 | |||
connect(cnt, SIGNAL(valueChanged(double)), my_class, SLOT(newValue(double)) ); | connect(cnt, SIGNAL(valueChanged(double)), my_class, SLOT(newValue(double)) ); | |||
\endcode | \endcode | |||
*/ | */ | |||
class QWT_EXPORT QwtCounter : public QWidget, public QwtDoubleRange | class QWT_EXPORT QwtCounter : public QWidget, public QwtDoubleRange | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
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 basicstep READ step WRITE setStep ) | |||
Q_PROPERTY( double minValue READ minVal WRITE setMinValue ) | Q_PROPERTY( double minValue READ minValue WRITE setMinValue ) | |||
Q_PROPERTY( double maxValue READ maxVal WRITE setMaxValue ) | 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( double value READ value WRITE setValue ) | |||
Q_PROPERTY( bool editable READ editable WRITE setEditable ) | Q_PROPERTY( bool editable READ editable WRITE setEditable ) | |||
public: | public: | |||
/*! | //! Button index | |||
Button index | ||||
*/ | ||||
enum Button | enum Button | |||
{ | { | |||
//! Button intended for minor steps | ||||
Button1, | Button1, | |||
//! Button intended for medium steps | ||||
Button2, | Button2, | |||
//! Button intended for large steps | ||||
Button3, | Button3, | |||
//! Number of buttons | ||||
ButtonCnt | ButtonCnt | |||
}; | }; | |||
explicit QwtCounter(QWidget *parent = NULL); | explicit QwtCounter( QWidget *parent = NULL ); | |||
#if QT_VERSION < 0x040000 | ||||
explicit QwtCounter(QWidget *parent, const char *name); | ||||
#endif | ||||
virtual ~QwtCounter(); | virtual ~QwtCounter(); | |||
bool editable() const; | bool editable() const; | |||
void setEditable(bool); | void setEditable( 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 void setValue( double ); | |||
virtual QSize sizeHint() const; | virtual QSize sizeHint() const; | |||
virtual void polish(); | ||||
// a set of dummies to help the designer | // a set of dummies to help the designer | |||
double step() const; | double step() const; | |||
void setStep(double s); | void setStep( double s ); | |||
double minVal() const; | ||||
void setMinValue(double m); | double minValue() const; | |||
double maxVal() const; | void setMinValue( double m ); | |||
void setMaxValue(double m); | ||||
void setStepButton1(int nSteps); | double maxValue() const; | |||
void setMaxValue( double m ); | ||||
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; | virtual double value() const; | |||
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(); | virtual void rangeChange(); | |||
private slots: | private Q_SLOTS: | |||
void btnReleased(); | void btnReleased(); | |||
void btnClicked(); | void btnClicked(); | |||
void textChanged(); | void textChanged(); | |||
private: | private: | |||
void initCounter(); | void initCounter(); | |||
void updateButtons(); | void updateButtons(); | |||
void showNum(double); | void showNum( double ); | |||
virtual void valueChange(); | virtual void valueChange(); | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 25 change blocks. | ||||
36 lines changed or deleted | 39 lines changed or added | |||
qwt_curve_fitter.h | qwt_curve_fitter.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_CURVE_FITTER_H | #ifndef QWT_CURVE_FITTER_H | |||
#define QWT_CURVE_FITTER_H | #define QWT_CURVE_FITTER_H | |||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include "qwt_double_rect.h" | #include <qpolygon.h> | |||
#include <qrect.h> | ||||
class QwtSpline; | class QwtSpline; | |||
#if QT_VERSION >= 0x040000 | ||||
#include <QPolygonF> | ||||
#else | ||||
#include "qwt_array.h" | ||||
#endif | ||||
// MOC_SKIP_BEGIN | ||||
#if defined(QWT_TEMPLATEDLL) | ||||
#if QT_VERSION < 0x040000 | ||||
#ifndef QWTARRAY_TEMPLATE_QWTDOUBLEPOINT // by mjo3 | ||||
#define QWTARRAY_TEMPLATE_QWTDOUBLEPOINT | ||||
template class QWT_EXPORT QwtArray<QwtDoublePoint>; | ||||
#endif //end of QWTARRAY_TEMPLATE_QWTDOUBLEPOINT | ||||
#endif | ||||
#endif | ||||
// MOC_SKIP_END | ||||
/*! | /*! | |||
\brief Abstract base class for a curve fitter | \brief Abstract base class for a curve fitter | |||
*/ | */ | |||
class QWT_EXPORT QwtCurveFitter | class QWT_EXPORT QwtCurveFitter | |||
{ | { | |||
public: | public: | |||
virtual ~QwtCurveFitter(); | virtual ~QwtCurveFitter(); | |||
#if QT_VERSION < 0x040000 | ||||
virtual QwtArray<QwtDoublePoint> fitCurve( | ||||
const QwtArray<QwtDoublePoint>&) const = 0; | ||||
#else | ||||
/*! | /*! | |||
Find a curve which has the best fit to a series of data points | Find a curve which has the best fit to a series of data points | |||
\param polygon Series of data points | \param polygon Series of data points | |||
\return Curve points | \return Curve points | |||
*/ | */ | |||
virtual QPolygonF fitCurve(const QPolygonF &polygon) const = 0; | virtual QPolygonF fitCurve( const QPolygonF &polygon ) const = 0; | |||
#endif | ||||
protected: | protected: | |||
QwtCurveFitter(); | QwtCurveFitter(); | |||
private: | private: | |||
QwtCurveFitter( const QwtCurveFitter & ); | QwtCurveFitter( const QwtCurveFitter & ); | |||
QwtCurveFitter &operator=( const QwtCurveFitter & ); | QwtCurveFitter &operator=( const QwtCurveFitter & ); | |||
}; | }; | |||
/*! | /*! | |||
\brief A curve fitter using cubic splines | \brief A curve fitter using cubic splines | |||
*/ | */ | |||
class QWT_EXPORT QwtSplineCurveFitter: public QwtCurveFitter | class QWT_EXPORT QwtSplineCurveFitter: public QwtCurveFitter | |||
{ | { | |||
public: | public: | |||
/*! | ||||
Spline type | ||||
The default setting is Auto | ||||
\sa setFitMode(), FitMode() | ||||
*/ | ||||
enum FitMode | enum FitMode | |||
{ | { | |||
/*! | ||||
Use the default spline algorithm for polygons with | ||||
increasing x values ( p[i-1] < p[i] ), otherwise use | ||||
a parametric spline algorithm. | ||||
*/ | ||||
Auto, | Auto, | |||
//! Use a default spline algorithm | ||||
Spline, | Spline, | |||
//! Use a parametric spline algorithm | ||||
ParametricSpline | ParametricSpline | |||
}; | }; | |||
QwtSplineCurveFitter(); | QwtSplineCurveFitter(); | |||
virtual ~QwtSplineCurveFitter(); | virtual ~QwtSplineCurveFitter(); | |||
void setFitMode(FitMode); | void setFitMode( FitMode ); | |||
FitMode fitMode() const; | FitMode fitMode() const; | |||
void setSpline(const QwtSpline&); | void setSpline( const QwtSpline& ); | |||
const QwtSpline &spline() const; | const QwtSpline &spline() const; | |||
QwtSpline &spline(); | QwtSpline &spline(); | |||
void setSplineSize(int size); | void setSplineSize( int size ); | |||
int splineSize() const; | int splineSize() const; | |||
#if QT_VERSION < 0x040000 | virtual QPolygonF fitCurve( const QPolygonF & ) const; | |||
virtual QwtArray<QwtDoublePoint> fitCurve( | ||||
const QwtArray<QwtDoublePoint> &) const; | ||||
#else | ||||
virtual QPolygonF fitCurve(const QPolygonF &) const; | ||||
#endif | ||||
private: | private: | |||
#if QT_VERSION < 0x040000 | QPolygonF fitSpline( const QPolygonF & ) const; | |||
QwtArray<QwtDoublePoint> fitSpline( | QPolygonF fitParametric( const QPolygonF & ) const; | |||
const QwtArray<QwtDoublePoint> &) const; | ||||
QwtArray<QwtDoublePoint> fitParametric( | class PrivateData; | |||
const QwtArray<QwtDoublePoint> &) const; | PrivateData *d_data; | |||
#else | }; | |||
QPolygonF fitSpline(const QPolygonF &) const; | ||||
QPolygonF fitParametric(const QPolygonF &) const; | /*! | |||
#endif | \brief A curve fitter implementing Douglas and Peucker algorithm | |||
The purpose of the Douglas and Peucker algorithm is that given a 'curve' | ||||
composed of line segments to find a curve not too dissimilar but that | ||||
has fewer points. The algorithm defines 'too dissimilar' based on the | ||||
maximum distance (tolerance) between the original curve and the | ||||
smoothed curve. | ||||
The smoothed curve consists of a subset of the points that defined the | ||||
original curve. | ||||
In opposite to QwtSplineCurveFitter the Douglas and Peucker algorithm red | ||||
uces | ||||
the number of points. By adjusting the tolerance parameter according to t | ||||
he | ||||
axis scales QwtSplineCurveFitter can be used to implement different | ||||
level of details to speed up painting of curves of many points. | ||||
*/ | ||||
class QWT_EXPORT QwtWeedingCurveFitter: public QwtCurveFitter | ||||
{ | ||||
public: | ||||
QwtWeedingCurveFitter( double tolerance = 1.0 ); | ||||
virtual ~QwtWeedingCurveFitter(); | ||||
void setTolerance( double ); | ||||
double tolerance() const; | ||||
virtual QPolygonF fitCurve( const QPolygonF & ) const; | ||||
private: | ||||
class Line; | ||||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 13 change blocks. | ||||
46 lines changed or deleted | 60 lines changed or added | |||
qwt_dial.h | qwt_dial.h | |||
---|---|---|---|---|
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | |||
* Qwt Widget Library | * Qwt Widget Library | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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 | |||
************************************************************************** ***/ | ************************************************************************** ***/ | |||
// vim: expandtab | ||||
#ifndef QWT_DIAL_H | #ifndef QWT_DIAL_H | |||
#define QWT_DIAL_H 1 | #define QWT_DIAL_H 1 | |||
#include <qframe.h> | ||||
#include <qpalette.h> | ||||
#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_round_scale_draw.h" | |||
#include <qframe.h> | ||||
#include <qpalette.h> | ||||
class QwtDialNeedle; | class QwtDialNeedle; | |||
class QwtDial; | class QwtDial; | |||
/*! | /*! | |||
\brief A special scale draw made for QwtDial | \brief A special scale draw made for QwtDial | |||
\sa QwtDial, QwtCompass | \sa QwtDial, QwtCompass | |||
*/ | */ | |||
class QWT_EXPORT QwtDialScaleDraw: public QwtRoundScaleDraw | class QWT_EXPORT QwtDialScaleDraw: public QwtRoundScaleDraw | |||
{ | { | |||
public: | public: | |||
explicit QwtDialScaleDraw(QwtDial *); | explicit QwtDialScaleDraw( QwtDial * ); | |||
virtual QwtText label(double value) const; | ||||
void setPenWidth(uint); | virtual QwtText label( double value ) const; | |||
uint penWidth() const; | ||||
void setPenWidth( double ); | ||||
double penWidth() const; | ||||
private: | private: | |||
QwtDial *d_parent; | QwtDial *d_parent; | |||
int d_penWidth; | 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 | |||
skipping to change at line 71 | skipping to change at line 70 | |||
Contributions are very welcome. | Contributions are very welcome. | |||
\sa QwtCompass, QwtAnalogClock, QwtDialNeedle | \sa QwtCompass, QwtAnalogClock, QwtDialNeedle | |||
\note The examples/dials example shows different types of dials. | \note The examples/dials example shows different types of dials. | |||
*/ | */ | |||
class QWT_EXPORT QwtDial: public QwtAbstractSlider | class QWT_EXPORT QwtDial: public QwtAbstractSlider | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
Q_ENUMS(Shadow) | Q_ENUMS( Shadow ) | |||
Q_ENUMS(Mode) | Q_ENUMS( Mode ) | |||
Q_ENUMS(Direction) | Q_ENUMS( Direction ) | |||
Q_PROPERTY(bool visibleBackground READ hasVisibleBackground WRITE showB | Q_PROPERTY( int lineWidth READ lineWidth WRITE setLineWidth ) | |||
ackground) | Q_PROPERTY( Shadow frameShadow READ frameShadow WRITE setFrameShadow ) | |||
Q_PROPERTY(int lineWidth READ lineWidth WRITE setLineWidth) | Q_PROPERTY( Mode mode READ mode WRITE setMode ) | |||
Q_PROPERTY(Shadow frameShadow READ frameShadow WRITE setFrameShadow) | Q_PROPERTY( double origin READ origin WRITE setOrigin ) | |||
Q_PROPERTY(Mode mode READ mode WRITE setMode) | Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping ) | |||
Q_PROPERTY(double origin READ origin WRITE setOrigin) | Q_PROPERTY( Direction direction READ direction WRITE setDirection ) | |||
Q_PROPERTY(bool wrapping READ wrapping WRITE setWrapping) | ||||
Q_PROPERTY(Direction direction READ direction WRITE setDirection) | ||||
friend class QwtDialScaleDraw; | 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. | |||
*/ | */ | |||
enum Shadow | enum Shadow | |||
{ | { | |||
//! QFrame::Plain | ||||
Plain = QFrame::Plain, | Plain = QFrame::Plain, | |||
//! QFrame::Raised | ||||
Raised = QFrame::Raised, | Raised = QFrame::Raised, | |||
Sunken = QFrame::Sunken | ||||
}; | ||||
//! see QwtDial::setScaleOptions | //! QFrame::Sunken | |||
enum ScaleOptions | Sunken = QFrame::Sunken | |||
{ | ||||
ScaleBackbone = 1, | ||||
ScaleTicks = 2, | ||||
ScaleLabel = 4 | ||||
}; | }; | |||
/*! | //! Mode controlling wether the needle or the scale is rotating | |||
In case of RotateNeedle the needle is rotating, in case of | ||||
RotateScale, the needle points to origin() | ||||
and the scale is rotating. | ||||
*/ | ||||
enum Mode | enum Mode | |||
{ | { | |||
//! The needle is rotating | ||||
RotateNeedle, | RotateNeedle, | |||
//! The needle is fixed, the scales are rotating | ||||
RotateScale | RotateScale | |||
}; | }; | |||
/*! | //! Direction of the dial | |||
Direction of the dial | ||||
*/ | ||||
enum Direction | enum Direction | |||
{ | { | |||
//! Clockwise | ||||
Clockwise, | Clockwise, | |||
//! Counter clockwise | ||||
CounterClockwise | CounterClockwise | |||
}; | }; | |||
explicit QwtDial( QWidget *parent = NULL); | explicit QwtDial( QWidget *parent = NULL ); | |||
#if QT_VERSION < 0x040000 | ||||
explicit QwtDial( QWidget *parent, const char *name); | ||||
#endif | ||||
virtual ~QwtDial(); | virtual ~QwtDial(); | |||
void setFrameShadow(Shadow); | void setFrameShadow( Shadow ); | |||
Shadow frameShadow() const; | Shadow frameShadow() const; | |||
bool hasVisibleBackground() const; | void setLineWidth( int ); | |||
void showBackground(bool); | ||||
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); | virtual void setWrapping( bool ); | |||
bool wrapping() const; | bool wrapping() const; | |||
virtual void setScale(int maxMajIntv, int maxMinIntv, double step = 0.0 ); | virtual void setScale( int maxMajIntv, int maxMinIntv, double step = 0. 0 ); | |||
void setScaleArc(double min, double max); | void setScaleArc( double min, double max ); | |||
void setScaleOptions(int); | void setScaleComponents( QwtAbstractScaleDraw::ScaleComponents ); | |||
void setScaleTicks(int minLen, int medLen, int majLen, int penWidth = 1 | void setScaleTicks( int minLen, int medLen, int majLen, int penWidth = | |||
); | 1 ); | |||
double minScaleArc() const; | double minScaleArc() const; | |||
double maxScaleArc() const; | double maxScaleArc() const; | |||
virtual void setOrigin(double); | virtual void setOrigin( double ); | |||
double origin() const; | double origin() const; | |||
void setDirection(Direction); | void setDirection( Direction ); | |||
Direction direction() const; | Direction direction() const; | |||
virtual void setNeedle(QwtDialNeedle *); | virtual void setNeedle( QwtDialNeedle * ); | |||
const QwtDialNeedle *needle() const; | const QwtDialNeedle *needle() const; | |||
QwtDialNeedle *needle(); | QwtDialNeedle *needle(); | |||
QRect boundingRect() const; | QRectF boundingRect() const; | |||
QRect contentsRect() const; | QRectF innerRect() const; | |||
virtual QRect scaleContentsRect() const; | virtual QRectF scaleInnerRect() const; | |||
virtual QSize sizeHint() const; | virtual QSize sizeHint() const; | |||
virtual QSize minimumSizeHint() const; | virtual QSize minimumSizeHint() const; | |||
virtual void setScaleDraw(QwtDialScaleDraw *); | virtual void setScaleDraw( QwtDialScaleDraw * ); | |||
QwtDialScaleDraw *scaleDraw(); | QwtDialScaleDraw *scaleDraw(); | |||
const QwtDialScaleDraw *scaleDraw() const; | const QwtDialScaleDraw *scaleDraw() const; | |||
protected: | protected: | |||
virtual void paintEvent(QPaintEvent *); | virtual void paintEvent( QPaintEvent * ); | |||
virtual void resizeEvent(QResizeEvent *); | virtual void keyPressEvent( QKeyEvent * ); | |||
virtual void keyPressEvent(QKeyEvent *); | ||||
virtual void updateMask(); | ||||
virtual void drawFrame(QPainter *p); | ||||
virtual void drawContents(QPainter *) const; | ||||
virtual void drawFocusIndicator(QPainter *) const; | ||||
virtual void drawScale(QPainter *, const QPoint ¢er, | virtual void drawFrame( QPainter *p ); | |||
int radius, double origin, double arcMin, double arcMax) const; | virtual void drawContents( QPainter * ) const; | |||
virtual void drawFocusIndicator( QPainter * ) const; | ||||
virtual void drawScale( | ||||
QPainter *, const QPointF ¢er, | ||||
double radius, double origin, | ||||
double arcMin, double arcMax ) const; | ||||
/*! | /*! | |||
Draw the contents inside the scale | Draw the contents inside the scale | |||
Paints nothing. | Paints nothing. | |||
\param painter Painter | \param painter Painter | |||
\param center Center of the contents circle | \param center Center of the contents circle | |||
\param radius Radius of the contents circle | \param radius Radius of the contents circle | |||
*/ | */ | |||
virtual void drawScaleContents(QPainter *painter, const QPoint ¢er, | virtual void drawScaleContents( QPainter *painter, | |||
int radius) const; | const QPointF ¢er, double radius ) const; | |||
virtual void drawNeedle(QPainter *, const QPoint &, | virtual void drawNeedle( QPainter *, const QPointF &, | |||
int radius, double direction, QPalette::ColorGroup) const; | double radius, double direction, QPalette::ColorGroup ) const; | |||
virtual QwtText scaleLabel(double) const; | virtual QwtText scaleLabel( double ) const; | |||
void updateScale(); | void updateScale(); | |||
virtual void rangeChange(); | virtual void rangeChange(); | |||
virtual void valueChange(); | virtual void valueChange(); | |||
virtual double getValue(const QPoint &); | virtual double getValue( const QPoint & ); | |||
virtual void getScrollMode(const QPoint &, | virtual void getScrollMode( const QPoint &, | |||
int &scrollMode, int &direction); | QwtAbstractSlider::ScrollMode &, int &direction ) const; | |||
private: | private: | |||
void initDial(); | void initDial(); | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 35 change blocks. | ||||
80 lines changed or deleted | 66 lines changed or added | |||
qwt_dial_needle.h | qwt_dial_needle.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_DIAL_NEEDLE_H | #ifndef QWT_DIAL_NEEDLE_H | |||
#define QWT_DIAL_NEEDLE_H 1 | #define QWT_DIAL_NEEDLE_H 1 | |||
#include <qpalette.h> | ||||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include <qpalette.h> | ||||
class QPainter; | class QPainter; | |||
class QPoint; | class QPoint; | |||
/*! | /*! | |||
\brief Base class for needles that can be used in a QwtDial. | \brief Base class for needles that can be used in a QwtDial. | |||
QwtDialNeedle is a pointer that indicates a value by pointing | QwtDialNeedle is a pointer that indicates a value by pointing | |||
to a specific direction. | to a specific direction. | |||
skipping to change at line 37 | skipping to change at line 37 | |||
\sa QwtDial, QwtCompass | \sa QwtDial, QwtCompass | |||
*/ | */ | |||
class QWT_EXPORT QwtDialNeedle | class QWT_EXPORT QwtDialNeedle | |||
{ | { | |||
public: | public: | |||
QwtDialNeedle(); | QwtDialNeedle(); | |||
virtual ~QwtDialNeedle(); | virtual ~QwtDialNeedle(); | |||
virtual void setPalette( const QPalette & ); | ||||
const QPalette &palette() const; | ||||
virtual void draw( QPainter *painter, const QPointF ¢er, | ||||
double length, double direction, | ||||
QPalette::ColorGroup = QPalette::Active ) const; | ||||
protected: | ||||
/*! | /*! | |||
Draw the needle | \brief Draw the needle | |||
\param painter Painter | The origin of the needle is at position (0.0, 0.0 ) | |||
\param center Center of the dial, start position for the needle | pointing in direction 0.0 ( = east ). | |||
\param length Length of the needle | ||||
\param direction Direction of the needle, in degrees counter clockw | ||||
ise | ||||
\param cg Color group, used for painting | ||||
*/ | ||||
virtual void draw(QPainter *painter, const QPoint ¢er, | ||||
int length, double direction, | ||||
QPalette::ColorGroup cg = QPalette::Active) const = 0; | ||||
virtual void setPalette(const QPalette &); | The painter is already initilaized with translation and | |||
const QPalette &palette() const; | rotation. | |||
protected: | \param painter Painter | |||
static void drawKnob(QPainter *, const QPoint &pos, | \param length Length of the needle | |||
int width, const QBrush &, bool sunken); | \param colorGroup Color group, used for painting | |||
\sa setPalette(), palette() | ||||
*/ | ||||
virtual void drawNeedle( QPainter *painter, | ||||
double length, QPalette::ColorGroup colorGroup ) const = 0; | ||||
virtual void drawKnob( QPainter *, double width, | ||||
const QBrush &, bool sunken ) const; | ||||
private: | private: | |||
QPalette d_palette; | QPalette d_palette; | |||
}; | }; | |||
/*! | /*! | |||
\brief A needle for dial widgets | \brief A needle for dial widgets | |||
The following colors are used: | The following colors are used: | |||
- QColorGroup::Mid\n | ||||
- QPalette::Mid\n | ||||
Pointer | Pointer | |||
- QColorGroup::base\n | - QPalette::Base\n | |||
Knob | Knob | |||
\sa QwtDial, QwtCompass | \sa QwtDial, QwtCompass | |||
*/ | */ | |||
class QWT_EXPORT QwtDialSimpleNeedle: public QwtDialNeedle | class QWT_EXPORT QwtDialSimpleNeedle: public QwtDialNeedle | |||
{ | { | |||
public: | public: | |||
//! Style of the needle | //! Style of the needle | |||
enum Style | enum Style | |||
{ | { | |||
//! Arrow | ||||
Arrow, | Arrow, | |||
//! A straight line from the center | ||||
Ray | Ray | |||
}; | }; | |||
QwtDialSimpleNeedle(Style, bool hasKnob = true, | QwtDialSimpleNeedle( Style, bool hasKnob = true, | |||
const QColor &mid = Qt::gray, const QColor &base = Qt::darkGray); | const QColor &mid = Qt::gray, const QColor &base = Qt::darkGray ); | |||
virtual void draw(QPainter *, const QPoint &, int length, | void setWidth( double width ); | |||
double direction, QPalette::ColorGroup = QPalette::Active) const; | double width() const; | |||
static void drawArrowNeedle(QPainter *, | protected: | |||
const QPalette&, QPalette::ColorGroup, | virtual void drawNeedle( QPainter *, double length, | |||
const QPoint &, int length, int width, double direction, | QPalette::ColorGroup ) const; | |||
bool hasKnob); | ||||
static void drawRayNeedle(QPainter *, | ||||
const QPalette&, QPalette::ColorGroup, | ||||
const QPoint &, int length, int width, double direction, | ||||
bool hasKnob); | ||||
void setWidth(int width); | ||||
int width() const; | ||||
private: | private: | |||
Style d_style; | Style d_style; | |||
bool d_hasKnob; | bool d_hasKnob; | |||
int d_width; | double d_width; | |||
}; | }; | |||
/*! | /*! | |||
\brief A magnet needle for compass widgets | \brief A magnet needle for compass widgets | |||
A magnet needle points to two opposite directions indicating | A magnet needle points to two opposite directions indicating | |||
north and south. | north and south. | |||
The following colors are used: | The following colors are used: | |||
- QColorGroup::Light\n | - QPalette::Light\n | |||
Used for pointing south | Used for pointing south | |||
- QColorGroup::Dark\n | - QPalette::Dark\n | |||
Used for pointing north | Used for pointing north | |||
- QColorGroup::Base\n | - QPalette::Base\n | |||
Knob (ThinStyle only) | Knob (ThinStyle only) | |||
\sa QwtDial, QwtCompass | \sa QwtDial, QwtCompass | |||
*/ | */ | |||
class QWT_EXPORT QwtCompassMagnetNeedle: public QwtDialNeedle | class QWT_EXPORT QwtCompassMagnetNeedle: public QwtDialNeedle | |||
{ | { | |||
public: | public: | |||
//! Style of the needle | //! Style of the needle | |||
enum Style | enum Style | |||
{ | { | |||
//! A needle with a triangular shape | ||||
TriangleStyle, | TriangleStyle, | |||
//! A thin needle | ||||
ThinStyle | ThinStyle | |||
}; | }; | |||
QwtCompassMagnetNeedle(Style = TriangleStyle, | ||||
const QColor &light = Qt::white, const QColor &dark = Qt::red); | ||||
virtual void draw(QPainter *, const QPoint &, int length, | ||||
double direction, QPalette::ColorGroup = QPalette::Active) const; | ||||
static void drawTriangleNeedle(QPainter *, | QwtCompassMagnetNeedle( Style = TriangleStyle, | |||
const QPalette &, QPalette::ColorGroup, | const QColor &light = Qt::white, const QColor &dark = Qt::red ); | |||
const QPoint &, int length, double direction); | ||||
static void drawThinNeedle(QPainter *, | ||||
const QPalette &, QPalette::ColorGroup, | ||||
const QPoint &, int length, double direction); | ||||
protected: | protected: | |||
static void drawPointer(QPainter *painter, const QBrush &brush, | virtual void drawNeedle( QPainter *, | |||
int colorOffset, const QPoint ¢er, | double length, QPalette::ColorGroup ) const; | |||
int length, int width, double direction); | ||||
private: | private: | |||
Style d_style; | Style d_style; | |||
}; | }; | |||
/*! | /*! | |||
\brief An indicator for the wind direction | \brief An indicator for the wind direction | |||
QwtCompassWindArrow shows the direction where the wind comes from. | QwtCompassWindArrow shows the direction where the wind comes from. | |||
- QColorGroup::Light\n | - QPalette::Light\n | |||
Used for Style1, or the light half of Style2 | Used for Style1, or the light half of Style2 | |||
- QColorGroup::Dark\n | - QPalette::Dark\n | |||
Used for the dark half of Style2 | Used for the dark half of Style2 | |||
\sa QwtDial, QwtCompass | \sa QwtDial, QwtCompass | |||
*/ | */ | |||
class QWT_EXPORT QwtCompassWindArrow: public QwtDialNeedle | class QWT_EXPORT QwtCompassWindArrow: public QwtDialNeedle | |||
{ | { | |||
public: | public: | |||
//! Style of the arrow | //! Style of the arrow | |||
enum Style | enum Style | |||
{ | { | |||
//! A needle pointing to the center | ||||
Style1, | Style1, | |||
//! A needle pointing to the center | ||||
Style2 | Style2 | |||
}; | }; | |||
QwtCompassWindArrow(Style, const QColor &light = Qt::white, | QwtCompassWindArrow( Style, const QColor &light = Qt::white, | |||
const QColor &dark = Qt::gray); | const QColor &dark = Qt::gray ); | |||
virtual void draw(QPainter *, const QPoint &, int length, | protected: | |||
double direction, QPalette::ColorGroup = QPalette::Active) const; | virtual void drawNeedle( QPainter *, | |||
double length, QPalette::ColorGroup ) const; | ||||
static void drawStyle1Needle(QPainter *, | ||||
const QPalette &, QPalette::ColorGroup, | ||||
const QPoint &, int length, double direction); | ||||
static void drawStyle2Needle(QPainter *, | ||||
const QPalette &, QPalette::ColorGroup, | ||||
const QPoint &, int length, double direction); | ||||
private: | private: | |||
Style d_style; | Style d_style; | |||
}; | }; | |||
#endif // QWT_DIAL_NEEDLE_H | #endif | |||
End of changes. 30 change blocks. | ||||
68 lines changed or deleted | 59 lines changed or added | |||
qwt_double_range.h | qwt_double_range.h | |||
---|---|---|---|---|
skipping to change at line 37 | skipping to change at line 37 | |||
interval when QwtDoubleRange::setValue(), QwtDoubleRange::fitValue(), | interval when QwtDoubleRange::setValue(), QwtDoubleRange::fitValue(), | |||
QwtDoubleRange::incValue() or QwtDoubleRange::incPages() are called. | QwtDoubleRange::incValue() or QwtDoubleRange::incPages() are called. | |||
*/ | */ | |||
class QWT_EXPORT QwtDoubleRange | class QWT_EXPORT QwtDoubleRange | |||
{ | { | |||
public: | public: | |||
QwtDoubleRange(); | QwtDoubleRange(); | |||
virtual ~QwtDoubleRange(); | virtual ~QwtDoubleRange(); | |||
void setRange(double vmin, double vmax, double vstep = 0.0, | void setRange( double vmin, double vmax, | |||
int pagesize = 1); | double vstep = 0.0, int pagesize = 1 ); | |||
void setValid(bool); | void setValid( bool ); | |||
bool isValid() const; | bool isValid() const; | |||
virtual void setValue(double); | virtual void setValue( double ); | |||
double value() const; | double value() const; | |||
void setPeriodic(bool tf); | void setPeriodic( bool tf ); | |||
bool periodic() const; | bool periodic() const; | |||
void setStep(double); | void setStep( double ); | |||
double step() const; | double step() const; | |||
double maxValue() const; | double maxValue() const; | |||
double minValue() const; | double minValue() const; | |||
int pageSize() const; | int pageSize() const; | |||
virtual void incValue(int); | virtual void incValue( int ); | |||
virtual void incPages(int); | virtual void incPages( int ); | |||
virtual void fitValue(double); | virtual void fitValue( double ); | |||
protected: | protected: | |||
double exactValue() const; | double exactValue() const; | |||
double exactPrevValue() const; | double exactPrevValue() const; | |||
double prevValue() const; | double prevValue() const; | |||
virtual void valueChange(); | virtual void valueChange(); | |||
virtual void stepChange(); | virtual void stepChange(); | |||
virtual void rangeChange(); | virtual void rangeChange(); | |||
private: | private: | |||
void setNewValue(double x, bool align = false); | void setNewValue( double value, bool align = false ); | |||
double d_minValue; | class PrivateData; | |||
double d_maxValue; | PrivateData *d_data; | |||
double d_step; | ||||
int d_pageSize; | ||||
bool d_isValid; | ||||
double d_value; | ||||
double d_exactValue; | ||||
double d_exactPrevValue; | ||||
double d_prevValue; | ||||
bool d_periodic; | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
22 lines changed or deleted | 12 lines changed or added | |||
qwt_dyngrid_layout.h | qwt_dyngrid_layout.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_DYNGRID_LAYOUT_H | #ifndef QWT_DYNGRID_LAYOUT_H | |||
#define QWT_DYNGRID_LAYOUT_H | #define QWT_DYNGRID_LAYOUT_H | |||
#include "qwt_global.h" | ||||
#include <qlayout.h> | #include <qlayout.h> | |||
#include <qsize.h> | #include <qsize.h> | |||
#if QT_VERSION >= 0x040000 | ||||
#include <qlist.h> | #include <qlist.h> | |||
#else | ||||
#include <qvaluelist.h> | ||||
#endif | ||||
#include "qwt_global.h" | ||||
#include "qwt_array.h" | ||||
/*! | /*! | |||
\brief The QwtDynGridLayout class lays out widgets in a grid, | \brief The QwtDynGridLayout class lays out widgets in a grid, | |||
adjusting the number of columns and rows to the current size. | adjusting the number of columns and rows to the current size. | |||
QwtDynGridLayout takes the space it gets, divides it up into rows and | QwtDynGridLayout takes the space it gets, divides it up into rows and | |||
columns, and puts each of the widgets it manages into the correct cell(s) . | columns, and puts each of the widgets it manages into the correct cell(s) . | |||
It lays out as many number of columns as possible (limited by maxCols()). | It lays out as many number of columns as possible (limited by maxCols()). | |||
*/ | */ | |||
class QWT_EXPORT QwtDynGridLayout : public QLayout | class QWT_EXPORT QwtDynGridLayout : public QLayout | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
explicit QwtDynGridLayout(QWidget *, int margin = 0, int space = -1); | explicit QwtDynGridLayout( QWidget *, int margin = 0, int space = -1 ); | |||
#if QT_VERSION < 0x040000 | explicit QwtDynGridLayout( int space = -1 ); | |||
explicit QwtDynGridLayout(QLayout *, int space = -1); | ||||
#endif | ||||
explicit QwtDynGridLayout(int space = -1); | ||||
virtual ~QwtDynGridLayout(); | virtual ~QwtDynGridLayout(); | |||
virtual void invalidate(); | virtual void invalidate(); | |||
void setMaxCols(uint maxCols); | void setMaxCols( uint maxCols ); | |||
uint maxCols() const; | uint maxCols() const; | |||
uint numRows () const; | uint numRows () const; | |||
uint numCols () const; | uint numCols () const; | |||
virtual void addItem(QLayoutItem *); | virtual void addItem( QLayoutItem * ); | |||
#if QT_VERSION >= 0x040000 | ||||
virtual QLayoutItem *itemAt( int index ) const; | virtual QLayoutItem *itemAt( int index ) const; | |||
virtual QLayoutItem *takeAt( int index ); | virtual QLayoutItem *takeAt( int index ); | |||
virtual int count() const; | virtual int count() const; | |||
void setExpandingDirections(Qt::Orientations); | void setExpandingDirections( Qt::Orientations ); | |||
virtual Qt::Orientations expandingDirections() const; | virtual Qt::Orientations expandingDirections() const; | |||
QList<QRect> layoutItems(const QRect &, uint numCols) const; | QList<QRect> layoutItems( const QRect &, uint numCols ) const; | |||
#else | ||||
virtual QLayoutIterator iterator(); | ||||
void setExpanding(QSizePolicy::ExpandData); | ||||
virtual QSizePolicy::ExpandData expanding() const; | ||||
QValueList<QRect> layoutItems(const QRect &, uint numCols) const; | ||||
#endif | ||||
virtual int maxItemWidth() const; | virtual int maxItemWidth() const; | |||
virtual void setGeometry(const QRect &rect); | virtual void setGeometry( const QRect &rect ); | |||
virtual bool hasHeightForWidth() const; | virtual bool hasHeightForWidth() const; | |||
virtual int heightForWidth(int) const; | virtual int heightForWidth( int ) const; | |||
virtual QSize sizeHint() const; | virtual QSize sizeHint() const; | |||
virtual bool isEmpty() const; | virtual bool isEmpty() const; | |||
uint itemCount() const; | uint itemCount() const; | |||
virtual uint columnsForWidth(int width) const; | virtual uint columnsForWidth( int width ) const; | |||
protected: | protected: | |||
void layoutGrid(uint numCols, | void layoutGrid( uint numCols, | |||
QwtArray<int>& rowHeight, QwtArray<int>& colWidth) const; | QVector<int>& rowHeight, QVector<int>& colWidth ) const; | |||
void stretchGrid(const QRect &rect, uint numCols, | void stretchGrid( const QRect &rect, uint numCols, | |||
QwtArray<int>& rowHeight, QwtArray<int>& colWidth) const; | QVector<int>& rowHeight, QVector<int>& colWidth ) const; | |||
private: | private: | |||
void init(); | void init(); | |||
int maxRowWidth(int numCols) const; | int maxRowWidth( int numCols ) const; | |||
void updateLayoutCache(); | ||||
#if QT_VERSION < 0x040000 | class PrivateData; | |||
// xlC 5.1, the IBM/AIX C++ compiler, needs it to be public | ||||
public: | ||||
#endif | ||||
class PrivateData; | ||||
private: | ||||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 15 change blocks. | ||||
39 lines changed or deleted | 16 lines changed or added | |||
qwt_event_pattern.h | qwt_event_pattern.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_EVENT_PATTERN | #ifndef QWT_EVENT_PATTERN | |||
#define QWT_EVENT_PATTERN 1 | #define QWT_EVENT_PATTERN 1 | |||
#include "qwt_global.h" | ||||
#include <qnamespace.h> | #include <qnamespace.h> | |||
#include "qwt_array.h" | #include <qvector.h> | |||
class QMouseEvent; | class QMouseEvent; | |||
class QKeyEvent; | class QKeyEvent; | |||
/*! | /*! | |||
\brief A collection of event patterns | \brief A collection of event patterns | |||
QwtEventPattern introduces an level of indirection for mouse and | QwtEventPattern introduces an level of indirection for mouse and | |||
keyboard inputs. Those are represented by symbolic names, so | keyboard inputs. Those are represented by symbolic names, so | |||
the application code can be configured by individual mappings. | the application code can be configured by individual mappings. | |||
skipping to change at line 140 | skipping to change at line 141 | |||
KeyUndo, | KeyUndo, | |||
KeyHome, | KeyHome, | |||
KeyPatternCount | KeyPatternCount | |||
}; | }; | |||
//! A pattern for mouse events | //! A pattern for mouse events | |||
class MousePattern | class MousePattern | |||
{ | { | |||
public: | public: | |||
MousePattern(int btn = Qt::NoButton, int st = Qt::NoButton) | //! Constructor | |||
MousePattern( int btn = Qt::NoButton, int st = Qt::NoButton ) | ||||
{ | { | |||
button = btn; | button = btn; | |||
state = st; | state = st; | |||
} | } | |||
//! Button code | ||||
int button; | int button; | |||
//! State | ||||
int state; | int state; | |||
}; | }; | |||
//! A pattern for key events | //! A pattern for key events | |||
class KeyPattern | class KeyPattern | |||
{ | { | |||
public: | public: | |||
KeyPattern(int k = 0, int st = Qt::NoButton) | //! Constructor | |||
KeyPattern( int k = 0, int st = Qt::NoButton ) | ||||
{ | { | |||
key = k; | key = k; | |||
state = st; | state = st; | |||
} | } | |||
//! Key code | ||||
int key; | int key; | |||
//! State | ||||
int state; | int state; | |||
}; | }; | |||
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::NoButton | void setMousePattern( uint pattern, int button, int state = Qt::NoButto | |||
); | n ); | |||
void setKeyPattern(uint pattern, int key, int state = Qt::NoButton); | void setKeyPattern( uint pattern, int key, int state = Qt::NoButton ); | |||
void setMousePattern(const QwtArray<MousePattern> &); | void setMousePattern( const QVector<MousePattern> & ); | |||
void setKeyPattern(const QwtArray<KeyPattern> &); | void setKeyPattern( const QVector<KeyPattern> & ); | |||
const QwtArray<MousePattern> &mousePattern() const; | const QVector<MousePattern> &mousePattern() const; | |||
const QwtArray<KeyPattern> &keyPattern() const; | const QVector<KeyPattern> &keyPattern() const; | |||
QwtArray<MousePattern> &mousePattern(); | QVector<MousePattern> &mousePattern(); | |||
QwtArray<KeyPattern> &keyPattern(); | QVector<KeyPattern> &keyPattern(); | |||
bool mouseMatch(uint pattern, const QMouseEvent *) const; | bool mouseMatch( uint pattern, const QMouseEvent * ) const; | |||
bool keyMatch(uint pattern, const QKeyEvent *) const; | bool keyMatch( uint pattern, const QKeyEvent * ) const; | |||
protected: | protected: | |||
virtual bool mouseMatch(const MousePattern &, const QMouseEvent *) cons | virtual bool mouseMatch( const MousePattern &, const QMouseEvent * ) co | |||
t; | 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) | |||
#endif | #endif | |||
QwtArray<MousePattern> d_mousePattern; | QVector<MousePattern> d_mousePattern; | |||
QwtArray<KeyPattern> d_keyPattern; | QVector<KeyPattern> d_keyPattern; | |||
#if defined(_MSC_VER) | #if defined(_MSC_VER) | |||
#pragma warning(pop) | #pragma warning(pop) | |||
#endif | #endif | |||
}; | }; | |||
inline bool operator==(QwtEventPattern::MousePattern b1, | //! Compare operator | |||
QwtEventPattern::MousePattern b2) | inline bool operator==( QwtEventPattern::MousePattern b1, | |||
QwtEventPattern::MousePattern b2 ) | ||||
{ | { | |||
return b1.button == b2.button && b1.state == b2.state; | return b1.button == b2.button && b1.state == b2.state; | |||
} | } | |||
inline bool operator==(QwtEventPattern::KeyPattern b1, | //! Compare operator | |||
QwtEventPattern::KeyPattern b2) | inline bool operator==( QwtEventPattern::KeyPattern b1, | |||
QwtEventPattern::KeyPattern b2 ) | ||||
{ | { | |||
return b1.key == b2.key && b1.state == b2.state; | return b1.key == b2.key && b1.state == b2.state; | |||
} | } | |||
#if defined(QWT_TEMPLATEDLL) | ||||
// MOC_SKIP_BEGIN | ||||
template class QWT_EXPORT QwtArray<QwtEventPattern::MousePattern>; | ||||
template class QWT_EXPORT QwtArray<QwtEventPattern::KeyPattern>; | ||||
// MOC_SKIP_END | ||||
#endif | ||||
#endif | #endif | |||
End of changes. 19 change blocks. | ||||
31 lines changed or deleted | 35 lines changed or added | |||
qwt_global.h | qwt_global.h | |||
---|---|---|---|---|
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | |||
* Qwt Widget Library | * Qwt Widget Library | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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 | |||
************************************************************************** ***/ | ************************************************************************** ***/ | |||
// vim: expandtab | ||||
#ifndef QWT_GLOBAL_H | #ifndef QWT_GLOBAL_H | |||
#define QWT_GLOBAL_H | #define QWT_GLOBAL_H | |||
#include <qglobal.h> | #include <qglobal.h> | |||
#if QT_VERSION < 0x040000 | ||||
#include <qmodules.h> | ||||
#endif | ||||
// QWT_VERSION is (major << 16) + (minor << 8) + patch. | // QWT_VERSION is (major << 16) + (minor << 8) + patch. | |||
#define QWT_VERSION 0x050202 | #define QWT_VERSION 0x060000 | |||
#define QWT_VERSION_STR "5.2.2" | #define QWT_VERSION_STR "6.0.0-svn" | |||
#if defined(Q_WS_WIN) || defined(Q_WS_S60) | #if defined(Q_WS_WIN) || defined(Q_WS_S60) | |||
#if defined(_MSC_VER) /* MSVC Compiler */ | #if defined(_MSC_VER) /* MSVC Compiler */ | |||
/* template-class specialization 'identifier' is already instantiated */ | /* template-class specialization 'identifier' is already instantiated */ | |||
#pragma warning(disable: 4660) | #pragma warning(disable: 4660) | |||
#endif // _MSC_VER | #endif // _MSC_VER | |||
#ifdef QWT_DLL | #ifdef QWT_DLL | |||
skipping to change at line 51 | skipping to change at line 46 | |||
#endif // QWT_DLL | #endif // QWT_DLL | |||
#endif // Q_WS_WIN || Q_WS_S60 | #endif // Q_WS_WIN || Q_WS_S60 | |||
#ifndef QWT_EXPORT | #ifndef QWT_EXPORT | |||
#define QWT_EXPORT | #define QWT_EXPORT | |||
#endif | #endif | |||
// #define QWT_NO_COMPAT 1 // disable withdrawn functionality | // #define QWT_NO_COMPAT 1 // disable withdrawn functionality | |||
#endif // QWT_GLOBAL_H | #endif | |||
End of changes. 4 change blocks. | ||||
7 lines changed or deleted | 2 lines changed or added | |||
qwt_knob.h | qwt_knob.h | |||
---|---|---|---|---|
skipping to change at line 37 | skipping to change at line 37 | |||
members, see QwtAbstractSlider. | members, see QwtAbstractSlider. | |||
\image html knob.png | \image html knob.png | |||
\sa QwtAbstractSlider and QwtAbstractScale for the descriptions | \sa QwtAbstractSlider and QwtAbstractScale for the descriptions | |||
of the inherited members. | of the inherited members. | |||
*/ | */ | |||
class QWT_EXPORT QwtKnob : public QwtAbstractSlider, public QwtAbstractScal e | class QWT_EXPORT QwtKnob : public QwtAbstractSlider, public QwtAbstractScal e | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
Q_ENUMS (Symbol) | ||||
Q_ENUMS ( KnobStyle ) | ||||
Q_ENUMS ( MarkerStyle ) | ||||
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( int borderWidth READ borderWidth WRITE setBorderWidth ) | |||
Q_PROPERTY( double totalAngle READ totalAngle WRITE setTotalAngle ) | Q_PROPERTY( double totalAngle READ totalAngle WRITE setTotalAngle ) | |||
Q_PROPERTY( Symbol symbol READ symbol WRITE setSymbol ) | Q_PROPERTY( int markerSize READ markerSize WRITE setMarkerSize ) | |||
Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth ) | ||||
public: | public: | |||
/*! | /*! | |||
Symbol | \brief Style of the knob surface | |||
\sa QwtKnob::QwtKnob() | ||||
*/ | ||||
enum Symbol { Line, Dot }; | Depending on the KnobStyle the surface of the knob is | |||
filled from the brushes of the widget palette(). | ||||
explicit QwtKnob(QWidget* parent = NULL); | \sa setKnobStyle(), knobStyle() | |||
#if QT_VERSION < 0x040000 | */ | |||
explicit QwtKnob(QWidget* parent, const char *name); | enum KnobStyle | |||
#endif | { | |||
//! Fill the knob with a brush from QPalette::Button. | ||||
NoStyle = -1, | ||||
//! Build a gradient from QPalette::Midlight and QPalette::Button | ||||
Raised, | ||||
/*! | ||||
Build a gradient from QPalette::Midlight, QPalette::Button | ||||
and QPalette::Midlight | ||||
*/ | ||||
Sunken | ||||
}; | ||||
/*! | ||||
\brief Marker type | ||||
The marker indicates the current value on the knob | ||||
The default setting is a Notch marker. | ||||
\sa setMarkerStyle(), setMarkerSize() | ||||
*/ | ||||
enum MarkerStyle | ||||
{ | ||||
//! Don't paint any marker | ||||
NoMarker = -1, | ||||
//! Paint a single tick in QPalette::ButtonText color | ||||
Tick, | ||||
//! Paint a circle in QPalette::ButtonText color | ||||
Dot, | ||||
/*! | ||||
Draw a raised ellipse with a gradient build from | ||||
QPalette::Light and QPalette::Mid | ||||
*/ | ||||
Nub, | ||||
/*! | ||||
Draw a sunken ellipse with a gradient build from | ||||
QPalette::Light and QPalette::Mid | ||||
*/ | ||||
Notch | ||||
}; | ||||
explicit QwtKnob( QWidget* parent = NULL ); | ||||
virtual ~QwtKnob(); | virtual ~QwtKnob(); | |||
void setKnobWidth(int w); | void setKnobWidth( int w ); | |||
int knobWidth() const; | int knobWidth() const; | |||
void setTotalAngle (double angle); | void setTotalAngle ( double angle ); | |||
double totalAngle() const; | double totalAngle() const; | |||
void setBorderWidth(int bw); | void setKnobStyle( KnobStyle ); | |||
KnobStyle knobStyle() const; | ||||
void setBorderWidth( int bw ); | ||||
int borderWidth() const; | int borderWidth() const; | |||
void setSymbol(Symbol); | void setMarkerStyle( MarkerStyle ); | |||
Symbol symbol() const; | MarkerStyle markerStyle() const; | |||
void setMarkerSize( int ); | ||||
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(); | |||
protected: | protected: | |||
virtual void paintEvent(QPaintEvent *e); | virtual void paintEvent( QPaintEvent * ); | |||
virtual void resizeEvent(QResizeEvent *e); | virtual void resizeEvent( QResizeEvent * ); | |||
virtual void changeEvent( QEvent * ); | ||||
void draw(QPainter *p, const QRect& ur); | ||||
void drawKnob(QPainter *p, const QRect &r); | virtual void drawKnob( QPainter *, const QRectF & ) const; | |||
void drawMarker(QPainter *p, double arc, const QColor &c); | virtual void drawMarker( QPainter *, | |||
const QRectF &, double arc ) const; | ||||
virtual double getValue( const QPoint &p ); | ||||
virtual void getScrollMode( const QPoint &, | ||||
QwtAbstractSlider::ScrollMode &, int &direction ) const; | ||||
private: | private: | |||
void initKnob(); | void initKnob(); | |||
void layoutKnob( bool update = true ); | void layoutKnob( bool update ); | |||
double getValue(const QPoint &p); | ||||
void getScrollMode( const QPoint &p, int &scrollMode, int &direction ); | ||||
void recalcAngle(); | void recalcAngle(); | |||
virtual void valueChange(); | virtual void valueChange(); | |||
virtual void rangeChange(); | virtual void rangeChange(); | |||
virtual void scaleChange(); | virtual void scaleChange(); | |||
virtual void fontChange(const QFont &oldFont); | ||||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 13 change blocks. | ||||
26 lines changed or deleted | 86 lines changed or added | |||
qwt_legend.h | qwt_legend.h | |||
---|---|---|---|---|
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | |||
* Qwt Widget Library | * Qwt Widget Library | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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 | |||
************************************************************************** ***/ | ************************************************************************** ***/ | |||
// vim: expandtab | ||||
#ifndef QWT_LEGEND_H | #ifndef QWT_LEGEND_H | |||
#define QWT_LEGEND_H | #define QWT_LEGEND_H | |||
#include <qframe.h> | ||||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#if QT_VERSION < 0x040000 | #include <qframe.h> | |||
#include <qvaluelist.h> | ||||
#else | ||||
#include <qlist.h> | #include <qlist.h> | |||
#endif | ||||
class QScrollBar; | class QScrollBar; | |||
class QwtLegendItemManager; | 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 QwtLegendItem. | |||
\sa QwtLegendItem, QwtLegendItemManager QwtPlot | \sa QwtLegendItem, QwtLegendItemManager QwtPlot | |||
*/ | */ | |||
class QWT_EXPORT QwtLegend : public QFrame | class QWT_EXPORT QwtLegend : public QFrame | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
/*! | /*! | |||
\brief Display policy | ||||
- NoIdentifier\n | ||||
The client code is responsible how to display of each legend item. | ||||
The Qwt library will not interfere. | ||||
- FixedIdentifier\n | ||||
All legend items are displayed with the QwtLegendItem::IdentifierM | ||||
ode | ||||
to be passed in 'mode'. | ||||
- AutoIdentifier\n | ||||
Each legend item is displayed with a mode that is a bitwise or of | ||||
- QwtLegendItem::ShowLine (if its curve is drawn with a line) and | ||||
- QwtLegendItem::ShowSymbol (if its curve is drawn with symbols) a | ||||
nd | ||||
- QwtLegendItem::ShowText (if the has a title). | ||||
Default is AutoIdentifier. | ||||
\sa setDisplayPolicy(), displayPolicy(), QwtLegendItem::IdentifierMo | ||||
de | ||||
*/ | ||||
enum LegendDisplayPolicy | ||||
{ | ||||
NoIdentifier = 0, | ||||
FixedIdentifier = 1, | ||||
AutoIdentifier = 2 | ||||
}; | ||||
/*! | ||||
\brief Interaction mode for the legend items | \brief Interaction mode for the legend items | |||
- ReadOnlyItem\n | The default is QwtLegend::ReadOnlyItem. | |||
The legend item is not interactive, like a label | ||||
- ClickableItem\n | ||||
The legend item is clickable, like a push button | ||||
- CheckableItem\n | ||||
The legend item is checkable, like a checkable button | ||||
Default is ReadOnlyItem. | ||||
\sa setItemMode(), itemMode(), QwtLegendItem::IdentifierMode | \sa setItemMode(), itemMode(), QwtLegendItem::IdentifierMode | |||
QwtLegendItem::clicked(), QwtLegendItem::checked(), | QwtLegendItem::clicked(), QwtLegendItem::checked(), | |||
QwtPlot::legendClicked(), QwtPlot::legendChecked() | QwtPlot::legendClicked(), QwtPlot::legendChecked() | |||
*/ | */ | |||
enum LegendItemMode | enum LegendItemMode | |||
{ | { | |||
//! The legend item is not interactive, like a label | ||||
ReadOnlyItem, | ReadOnlyItem, | |||
//! The legend item is clickable, like a push button | ||||
ClickableItem, | ClickableItem, | |||
//! The legend item is checkable, like a checkable button | ||||
CheckableItem | CheckableItem | |||
}; | }; | |||
explicit QwtLegend(QWidget *parent = NULL); | explicit QwtLegend( QWidget *parent = NULL ); | |||
virtual ~QwtLegend(); | virtual ~QwtLegend(); | |||
void setDisplayPolicy(LegendDisplayPolicy policy, int mode); | void setItemMode( LegendItemMode ); | |||
LegendDisplayPolicy displayPolicy() const; | ||||
void setItemMode(LegendItemMode); | ||||
LegendItemMode itemMode() const; | LegendItemMode itemMode() const; | |||
int identifierMode() const; | ||||
QWidget *contentsWidget(); | QWidget *contentsWidget(); | |||
const QWidget *contentsWidget() const; | const QWidget *contentsWidget() const; | |||
void insert(const QwtLegendItemManager *, QWidget *); | void insert( const QwtLegendItemManager *, QWidget * ); | |||
void remove(const QwtLegendItemManager *); | void remove( const QwtLegendItemManager * ); | |||
QWidget *find(const QwtLegendItemManager *) const; | QWidget *find( const QwtLegendItemManager * ) const; | |||
QwtLegendItemManager *find(const QWidget *) const; | QwtLegendItemManager *find( const QWidget * ) const; | |||
#if QT_VERSION < 0x040000 | ||||
virtual QValueList<QWidget *> legendItems() const; | ||||
#else | ||||
virtual QList<QWidget *> legendItems() const; | virtual QList<QWidget *> legendItems() const; | |||
#endif | ||||
void clear(); | void clear(); | |||
bool isEmpty() const; | bool isEmpty() const; | |||
uint itemCount() 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; | |||
protected: | protected: | |||
virtual void resizeEvent(QResizeEvent *); | ||||
virtual void layoutContents(); | virtual void layoutContents(); | |||
private: | private: | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif // QWT_LEGEND_H | #endif | |||
End of changes. 21 change blocks. | ||||
65 lines changed or deleted | 15 lines changed or added | |||
qwt_legend_item.h | qwt_legend_item.h | |||
---|---|---|---|---|
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | |||
* Qwt Widget Library | * Qwt Widget Library | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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 | |||
************************************************************************** ***/ | ************************************************************************** ***/ | |||
// vim: expandtab | ||||
#ifndef QWT_LEGEND_ITEM_H | #ifndef QWT_LEGEND_ITEM_H | |||
#define QWT_LEGEND_ITEM_H | #define QWT_LEGEND_ITEM_H | |||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include "qwt_legend.h" | #include "qwt_legend.h" | |||
#include "qwt_text.h" | #include "qwt_text.h" | |||
#include "qwt_text_label.h" | #include "qwt_text_label.h" | |||
#include <qpixmap.h> | ||||
class QPainter; | ||||
class QPen; | ||||
class QwtSymbol; | ||||
/*! | /*! | |||
\brief A legend label | \brief A widget representing something on a QwtLegend(). | |||
QwtLegendItem represents a curve on a legend. | ||||
It displays an curve identifier with an explaining text. | ||||
The identifier might be a combination of curve symbol and line. | ||||
In readonly mode it behaves like a label, otherwise like | ||||
an unstylish push button. | ||||
\sa QwtLegend, QwtPlotCurve | ||||
*/ | */ | |||
class QWT_EXPORT QwtLegendItem: public QwtTextLabel | class QWT_EXPORT QwtLegendItem: public QwtTextLabel | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
explicit QwtLegendItem( QWidget *parent = 0 ); | ||||
/*! | ||||
\brief Identifier mode | ||||
Default is ShowLine | ShowText | ||||
\sa identifierMode(), setIdentifierMode() | ||||
*/ | ||||
enum IdentifierMode | ||||
{ | ||||
NoIdentifier = 0, | ||||
ShowLine = 1, | ||||
ShowSymbol = 2, | ||||
ShowText = 4 | ||||
}; | ||||
explicit QwtLegendItem(QWidget *parent = 0); | ||||
explicit QwtLegendItem(const QwtSymbol &, const QPen &, | ||||
const QwtText &, QWidget *parent = 0); | ||||
virtual ~QwtLegendItem(); | virtual ~QwtLegendItem(); | |||
virtual void setText(const QwtText &); | void setItemMode( QwtLegend::LegendItemMode ); | |||
void setItemMode(QwtLegend::LegendItemMode); | ||||
QwtLegend::LegendItemMode itemMode() const; | QwtLegend::LegendItemMode itemMode() const; | |||
void setIdentifierMode(int); | void setSpacing( int spacing ); | |||
int identifierMode() const; | ||||
void setIdentifierWidth(int width); | ||||
int identifierWidth() const; | ||||
void setSpacing(int spacing); | ||||
int spacing() const; | int spacing() const; | |||
void setSymbol(const QwtSymbol &); | virtual void setText( const QwtText & ); | |||
const QwtSymbol& symbol() const; | ||||
void setCurvePen(const QPen &); | void setIdentifier( const QPixmap & ); | |||
const QPen& curvePen() const; | QPixmap identifier() const; | |||
virtual void drawIdentifier(QPainter *, const QRect &) const; | void setIdentifierSize( const QSize & ); | |||
virtual void drawItem(QPainter *p, const QRect &) const; | QSize identifierSize() const; | |||
virtual QSize sizeHint() const; | virtual QSize sizeHint() const; | |||
bool isChecked() const; | bool isChecked() const; | |||
public slots: | public Q_SLOTS: | |||
void setChecked(bool on); | void setChecked( bool on ); | |||
signals: | Q_SIGNALS: | |||
//! Signal, when the legend item has been clicked | //! Signal, when the legend item has been clicked | |||
void clicked(); | void clicked(); | |||
//! Signal, when the legend item has been pressed | //! Signal, when the legend item has been pressed | |||
void pressed(); | void pressed(); | |||
//! Signal, when the legend item has been relased | //! Signal, when the legend item has been relased | |||
void released(); | void released(); | |||
//! Signal, when the legend item has been toggled | //! Signal, when the legend item has been toggled | |||
void checked(bool); | void checked( bool ); | |||
protected: | protected: | |||
void setDown(bool); | void setDown( bool ); | |||
bool isDown() const; | bool isDown() const; | |||
virtual void paintEvent(QPaintEvent *); | virtual void paintEvent( QPaintEvent * ); | |||
virtual void mousePressEvent(QMouseEvent *); | virtual void mousePressEvent( QMouseEvent * ); | |||
virtual void mouseReleaseEvent(QMouseEvent *); | virtual void mouseReleaseEvent( QMouseEvent * ); | |||
virtual void keyPressEvent(QKeyEvent *); | virtual void keyPressEvent( QKeyEvent * ); | |||
virtual void keyReleaseEvent(QKeyEvent *); | virtual void keyReleaseEvent( QKeyEvent * ); | |||
virtual void drawText(QPainter *, const QRect &); | ||||
private: | private: | |||
void init(const QwtText &); | ||||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif // QWT_LEGEND_ITEM_H | #endif | |||
End of changes. 16 change blocks. | ||||
64 lines changed or deleted | 20 lines changed or added | |||
qwt_legend_itemmanager.h | qwt_legend_itemmanager.h | |||
---|---|---|---|---|
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | |||
* Qwt Widget Library | * Qwt Widget Library | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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 | |||
************************************************************************** ***/ | ************************************************************************** ***/ | |||
// vim: expandtab | ||||
#ifndef QWT_LEGEND_ITEM_MANAGER_H | #ifndef QWT_LEGEND_ITEM_MANAGER_H | |||
#define QWT_LEGEND_ITEM_MANAGER_H | #define QWT_LEGEND_ITEM_MANAGER_H | |||
#include "qwt_global.h" | #include "qwt_global.h" | |||
class QwtLegend; | class QwtLegend; | |||
class QWidget; | class QWidget; | |||
class QRectF; | ||||
class QPainter; | ||||
/*! | /*! | |||
\brief Abstract API to bind plot items to the legend | \brief Abstract API to bind plot items to the legend | |||
*/ | */ | |||
class QWT_EXPORT QwtLegendItemManager | class QWT_EXPORT QwtLegendItemManager | |||
{ | { | |||
public: | public: | |||
//! Constructor | //! Constructor | |||
QwtLegendItemManager() | QwtLegendItemManager() | |||
skipping to change at line 42 | skipping to change at line 42 | |||
//! Destructor | //! Destructor | |||
virtual ~QwtLegendItemManager() | virtual ~QwtLegendItemManager() | |||
{ | { | |||
} | } | |||
/*! | /*! | |||
Update the widget that represents the item on the legend | Update the widget that represents the item on the legend | |||
\param legend Legend | \param legend Legend | |||
\sa legendItem() | \sa legendItem() | |||
*/ | */ | |||
virtual void updateLegend(QwtLegend *legend) const = 0; | virtual void updateLegend( QwtLegend *legend ) const = 0; | |||
/*! | /*! | |||
Allocate the widget that represents the item on the legend | Allocate the widget that represents the item on the legend | |||
\return Allocated widget | \return Allocated widget | |||
\sa updateLegend() QwtLegend() | \sa updateLegend() QwtLegend() | |||
*/ | */ | |||
virtual QWidget *legendItem() const = 0; | virtual QWidget *legendItem() const = 0; | |||
/*! | ||||
QwtLegendItem can display an icon-identifier followed | ||||
by a text. The icon helps to identify a plot item on | ||||
the plot canvas and depends on the type of information, | ||||
that is displayed. | ||||
The default implementation paints nothing. | ||||
*/ | ||||
virtual void drawLegendIdentifier( QPainter *, const QRectF & ) const | ||||
{ | ||||
} | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 15 lines changed or added | |||
qwt_magnifier.h | qwt_magnifier.h | |||
---|---|---|---|---|
skipping to change at line 32 | skipping to change at line 32 | |||
\brief QwtMagnifier provides zooming, by magnifying in steps. | \brief QwtMagnifier provides zooming, by magnifying in steps. | |||
Using QwtMagnifier a plot can be zoomed in/out in steps using | Using QwtMagnifier a plot can be zoomed in/out in steps using | |||
keys, the mouse wheel or moving a mouse button in vertical direction. | keys, the mouse wheel or moving a mouse button in vertical direction. | |||
*/ | */ | |||
class QWT_EXPORT QwtMagnifier: public QObject | class QWT_EXPORT QwtMagnifier: public QObject | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
explicit QwtMagnifier(QWidget *); | explicit QwtMagnifier( QWidget * ); | |||
virtual ~QwtMagnifier(); | virtual ~QwtMagnifier(); | |||
QWidget *parentWidget(); | QWidget *parentWidget(); | |||
const QWidget *parentWidget() const; | const QWidget *parentWidget() const; | |||
void setEnabled(bool); | void setEnabled( bool ); | |||
bool isEnabled() const; | bool isEnabled() const; | |||
// mouse | // mouse | |||
void setMouseFactor(double); | void setMouseFactor( double ); | |||
double mouseFactor() const; | double mouseFactor() const; | |||
void setMouseButton(int button, int buttonState = Qt::NoButton); | void setMouseButton( int button, int buttonState = Qt::NoButton ); | |||
void getMouseButton(int &button, int &buttonState) const; | void getMouseButton( int &button, int &buttonState ) const; | |||
// mouse wheel | // mouse wheel | |||
void setWheelFactor(double); | void setWheelFactor( double ); | |||
double wheelFactor() const; | double wheelFactor() const; | |||
void setWheelButtonState(int buttonState); | void setWheelButtonState( int buttonState ); | |||
int wheelButtonState() const; | int wheelButtonState() const; | |||
// keyboard | // keyboard | |||
void setKeyFactor(double); | void setKeyFactor( double ); | |||
double keyFactor() const; | double keyFactor() const; | |||
void setZoomInKey(int key, int modifiers); | void setZoomInKey( int key, int modifiers ); | |||
void getZoomInKey(int &key, int &modifiers) const; | void getZoomInKey( int &key, int &modifiers ) const; | |||
void setZoomOutKey(int key, int modifiers); | void setZoomOutKey( int key, int modifiers ); | |||
void getZoomOutKey(int &key, int &modifiers) const; | void getZoomOutKey( int &key, int &modifiers ) const; | |||
virtual bool eventFilter(QObject *, QEvent *); | virtual bool eventFilter( QObject *, QEvent * ); | |||
protected: | protected: | |||
/*! | /*! | |||
Rescale the parent widget | Rescale the parent widget | |||
\param factor Scale factor | \param factor Scale factor | |||
*/ | */ | |||
virtual void rescale(double factor) = 0; | virtual void rescale( double factor ) = 0; | |||
virtual void widgetMousePressEvent(QMouseEvent *); | virtual void widgetMousePressEvent( QMouseEvent * ); | |||
virtual void widgetMouseReleaseEvent(QMouseEvent *); | virtual void widgetMouseReleaseEvent( QMouseEvent * ); | |||
virtual void widgetMouseMoveEvent(QMouseEvent *); | virtual void widgetMouseMoveEvent( QMouseEvent * ); | |||
virtual void widgetWheelEvent(QWheelEvent *); | virtual void widgetWheelEvent( QWheelEvent * ); | |||
virtual void widgetKeyPressEvent(QKeyEvent *); | virtual void widgetKeyPressEvent( QKeyEvent * ); | |||
virtual void widgetKeyReleaseEvent(QKeyEvent *); | virtual void widgetKeyReleaseEvent( QKeyEvent * ); | |||
private: | private: | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 12 change blocks. | ||||
20 lines changed or deleted | 20 lines changed or added | |||
qwt_math.h | qwt_math.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_MATH_H | #ifndef QWT_MATH_H | |||
#define QWT_MATH_H | #define QWT_MATH_H | |||
#include <math.h> | ||||
#include <qpoint.h> | ||||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include "qwt_double_rect.h" | ||||
#if QT_VERSION < 0x040000 | ||||
#define qwtMax QMAX | ||||
#define qwtMin QMIN | ||||
#define qwtAbs QABS | ||||
#else // QT_VERSION >= 0x040000 | ||||
#define qwtMax qMax | ||||
#define qwtMin qMin | ||||
#define qwtAbs qAbs | ||||
#if defined(_MSC_VER) | ||||
/* | ||||
Microsoft says: | ||||
Define _USE_MATH_DEFINES before including math.h to expose these macro | ||||
definitions for common math constants. These are placed under an #ifdef | ||||
since these commonly-defined names are not part of the C/C++ standards. | ||||
*/ | ||||
#define _USE_MATH_DEFINES 1 | ||||
#endif | #endif | |||
#include <qpoint.h> | ||||
#include <qmath.h> | ||||
#include "qwt_global.h" | ||||
#ifndef LOG10_2 | #ifndef LOG10_2 | |||
#define LOG10_2 0.30102999566398119802 /* log10(2) */ | #define LOG10_2 0.30102999566398119802 /* log10(2) */ | |||
#endif | #endif | |||
#ifndef LOG10_3 | #ifndef LOG10_3 | |||
#define LOG10_3 0.47712125471966243540 /* log10(3) */ | #define LOG10_3 0.47712125471966243540 /* log10(3) */ | |||
#endif | #endif | |||
#ifndef LOG10_5 | #ifndef LOG10_5 | |||
#define LOG10_5 0.69897000433601885749 /* log10(5) */ | #define LOG10_5 0.69897000433601885749 /* log10(5) */ | |||
skipping to change at line 110 | skipping to change at line 108 | |||
#endif | #endif | |||
#ifndef M_SQRT2 | #ifndef M_SQRT2 | |||
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ | #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ | |||
#endif | #endif | |||
#ifndef M_SQRT1_2 | #ifndef M_SQRT1_2 | |||
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ | #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ | |||
#endif | #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 ); | |||
//! Return the sign | /*! | |||
inline int qwtSign(double x) | \brief Compare 2 values, relative to an interval | |||
{ | ||||
if (x > 0.0) | ||||
return 1; | ||||
else if (x < 0.0) | ||||
return (-1); | ||||
else | ||||
return 0; | ||||
} | ||||
//! Return the square of a number | Values are "equal", when : | |||
inline double qwtSqr(const double x) | \f$\cdot value2 - value1 <= abs(intervalSize * 10e^{-6})\f$ | |||
{ | ||||
return x*x; | ||||
} | ||||
/*! | \param value1 First value to compare | |||
\brief Limit a value to fit into a specified interval | \param value2 Second value to compare | |||
\param x Input value | \param intervalSize interval size | |||
\param x1 First interval boundary | ||||
\param x2 Second interval boundary | \return 0: if equal, -1: if value2 > value1, 1: if value1 > value2 | |||
*/ | */ | |||
template <class T> | inline int qwtFuzzyCompare( double value1, double value2, double intervalSi | |||
T qwtLim(const T& x, const T& x1, const T& x2) | ze ) | |||
{ | { | |||
T rv; | const double eps = qAbs( 1.0e-6 * intervalSize ); | |||
T xmin, xmax; | ||||
xmin = qwtMin(x1, x2); | if ( value2 - value1 > eps ) | |||
xmax = qwtMax(x1, x2); | return -1; | |||
if ( x < xmin ) | if ( value1 - value2 > eps ) | |||
rv = xmin; | return 1; | |||
else if ( x > xmax ) | ||||
rv = xmax; | ||||
else | ||||
rv = x; | ||||
return rv; | return 0; | |||
} | } | |||
inline QPoint qwtPolar2Pos(const QPoint &pole, | inline bool qwtFuzzyGreaterOrEqual( double d1, double d2 ) | |||
double radius, double angle) | ||||
{ | { | |||
const double x = pole.x() + radius * ::cos(angle); | return ( d1 >= d2 ) || qFuzzyCompare( d1, d2 ); | |||
const double y = pole.y() - radius * ::sin(angle); | } | |||
return QPoint(qRound(x), qRound(y)); | inline bool qwtFuzzyLessOrEqual( double d1, double d2 ) | |||
{ | ||||
return ( d1 <= d2 ) || qFuzzyCompare( d1, d2 ); | ||||
} | } | |||
inline QPoint qwtDegree2Pos(const QPoint &pole, | //! Return the sign | |||
double radius, double angle) | inline int qwtSign( double x ) | |||
{ | { | |||
return qwtPolar2Pos(pole, radius, angle / 180.0 * M_PI); | if ( x > 0.0 ) | |||
return 1; | ||||
else if ( x < 0.0 ) | ||||
return ( -1 ); | ||||
else | ||||
return 0; | ||||
} | } | |||
inline QwtDoublePoint qwtPolar2Pos(const QwtDoublePoint &pole, | //! Return the square of a number | |||
double radius, double angle) | inline double qwtSqr( double x ) | |||
{ | { | |||
const double x = pole.x() + radius * ::cos(angle); | return x * x; | |||
const double y = pole.y() - radius * ::sin(angle); | } | |||
return QPoint(qRound(x), qRound(y)); | //! Like qRound, but without converting the result to an int | |||
inline double qwtRoundF(double d) | ||||
{ | ||||
return ::floor( d + 0.5 ); | ||||
} | } | |||
inline QwtDoublePoint qwtDegree2Pos(const QwtDoublePoint &pole, | //! Like qFloor, but without converting the result to an int | |||
double radius, double angle) | inline double qwtFloorF(double d) | |||
{ | { | |||
return qwtPolar2Pos(pole, radius, angle / 180.0 * M_PI); | return ::floor( d ); | |||
} | } | |||
//! Rounding of doubles, like qRound for integers | //! Like qCeil, but without converting the result to an int | |||
inline double qwtRound(double value) | inline double qwtCeilF(double d) | |||
{ | { | |||
return ::floor(value + 0.5); // MSVC has no ::round(). | return ::ceil( d ); | |||
} | } | |||
#endif | #endif | |||
End of changes. 25 change blocks. | ||||
69 lines changed or deleted | 60 lines changed or added | |||
qwt_painter.h | qwt_painter.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_PAINTER_H | #ifndef QWT_PAINTER_H | |||
#define QWT_PAINTER_H | #define QWT_PAINTER_H | |||
#include "qwt_global.h" | ||||
#include <qpoint.h> | #include <qpoint.h> | |||
#include <qrect.h> | #include <qrect.h> | |||
#include <qpen.h> | #include <qpen.h> | |||
#include "qwt_global.h" | #include <qline.h> | |||
#include "qwt_layout_metrics.h" | ||||
#include "qwt_polygon.h" | ||||
class QPainter; | class QPainter; | |||
class QBrush; | class QBrush; | |||
class QColor; | class QColor; | |||
class QWidget; | class QWidget; | |||
class QPolygonF; | ||||
class QRectF; | ||||
class QImage; | ||||
class QPixmap; | ||||
class QwtScaleMap; | class QwtScaleMap; | |||
class QwtColorMap; | class QwtColorMap; | |||
class QwtDoubleInterval; | class QwtInterval; | |||
#if QT_VERSION < 0x040000 | ||||
class QColorGroup; | ||||
class QSimpleRichText; | ||||
#else | ||||
class QPalette; | class QPalette; | |||
class QTextDocument; | class QTextDocument; | |||
#endif | class QPainterPath; | |||
#if defined(Q_WS_X11) | ||||
// Warning: QCOORD_MIN, QCOORD_MAX are wrong on X11. | ||||
#define QWT_COORD_MAX 16384 | ||||
#define QWT_COORD_MIN (-QWT_COORD_MAX - 1) | ||||
#else | ||||
#define QWT_COORD_MAX 2147483647 | ||||
#define QWT_COORD_MIN -QWT_COORD_MAX - 1 | ||||
#endif | ||||
/*! | /*! | |||
\brief A collection of QPainter workarounds | \brief A collection of QPainter workarounds | |||
1) Clipping to coordinate system limits (Qt3 only) | ||||
On X11 pixel coordinates are stored in shorts. Qt | ||||
produces overruns when mapping QCOORDS to shorts. | ||||
2) Scaling to device metrics | ||||
QPainter scales fonts, line and fill patterns to the metrics | ||||
of the paint device. Other values like the geometries of rects, points | ||||
remain device independend. To enable a device independent widget | ||||
implementation, QwtPainter adds scaling of these geometries. | ||||
(Unfortunately QPainter::scale scales both types of paintings, | ||||
so the objects of the first type would be scaled twice). | ||||
*/ | */ | |||
class QWT_EXPORT QwtPainter | class QWT_EXPORT QwtPainter | |||
{ | { | |||
public: | public: | |||
static void setMetricsMap(const QPaintDevice *layout, | static void setPolylineSplitting( bool ); | |||
const QPaintDevice *device); | static bool polylineSplitting(); | |||
static void setMetricsMap(const QwtMetricsMap &); | ||||
static void resetMetricsMap(); | static void setRoundingAlignment( bool ); | |||
static const QwtMetricsMap &metricsMap(); | static bool roundingAlignment(); | |||
static bool roundingAlignment(QPainter *); | ||||
static void setDeviceClipping(bool); | ||||
static bool deviceClipping(); | static void drawText( QPainter *, double x, double y, const QString & ) | |||
static const QRect &deviceClipRect(); | ; | |||
static void drawText( QPainter *, const QPointF &, const QString & ); | ||||
static void setClipRect(QPainter *, const QRect &); | static void drawText( QPainter *, double x, double y, double w, double | |||
h, | ||||
static void drawText(QPainter *, int x, int y, | int flags, const QString & ); | |||
const QString &); | static void drawText( QPainter *, const QRectF &, | |||
static void drawText(QPainter *, const QPoint &, | int flags, const QString & ); | |||
const QString &); | ||||
static void drawText(QPainter *, int x, int y, int w, int h, | ||||
int flags, const QString &); | ||||
static void drawText(QPainter *, const QRect &, | ||||
int flags, const QString &); | ||||
#ifndef QT_NO_RICHTEXT | #ifndef QT_NO_RICHTEXT | |||
#if QT_VERSION < 0x040000 | static void drawSimpleRichText( QPainter *, const QRectF &, | |||
static void drawSimpleRichText(QPainter *, const QRect &, | int flags, const QTextDocument & ); | |||
int flags, QSimpleRichText &); | ||||
#else | ||||
static void drawSimpleRichText(QPainter *, const QRect &, | ||||
int flags, QTextDocument &); | ||||
#endif | ||||
#endif | #endif | |||
static void drawRect(QPainter *, int x, int y, int w, int h); | static void drawRect( QPainter *, double x, double y, double w, double | |||
static void drawRect(QPainter *, const QRect &rect); | h ); | |||
static void fillRect(QPainter *, const QRect &, const QBrush &); | static void drawRect( QPainter *, const QRectF &rect ); | |||
static void fillRect( QPainter *, const QRectF &, const QBrush & ); | ||||
static void drawEllipse(QPainter *, const QRect &); | ||||
static void drawPie(QPainter *, const QRect & r, int a, int alen); | ||||
static void drawLine(QPainter *, int x1, int y1, int x2, int y2); | ||||
static void drawLine(QPainter *, const QPoint &p1, const QPoint &p2); | ||||
static void drawPolygon(QPainter *, const QwtPolygon &pa); | ||||
static void drawPolyline(QPainter *, const QwtPolygon &pa); | ||||
static void drawPoint(QPainter *, int x, int y); | ||||
#if QT_VERSION < 0x040000 | ||||
static void drawRoundFrame(QPainter *, const QRect &, | ||||
int width, const QColorGroup &cg, bool sunken); | ||||
#else | ||||
static void drawRoundFrame(QPainter *, const QRect &, | ||||
int width, const QPalette &, bool sunken); | ||||
#endif | ||||
static void drawFocusRect(QPainter *, QWidget *); | ||||
static void drawFocusRect(QPainter *, QWidget *, const QRect &); | ||||
static void drawColorBar(QPainter *painter, | static void drawEllipse( QPainter *, const QRectF & ); | |||
const QwtColorMap &, const QwtDoubleInterval &, | static void drawPie( QPainter *, const QRectF & r, int a, int alen ); | |||
const QwtScaleMap &, Qt::Orientation, const QRect &); | ||||
#if QT_VERSION < 0x040000 | ||||
static void setSVGMode(bool on); | ||||
static bool isSVGMode(); | ||||
#endif | ||||
static QPen scaledPen(const QPen &); | 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 QLineF & ); | ||||
private: | static void drawPolygon( QPainter *, const QPolygonF &pa ); | |||
static void drawColoredArc(QPainter *, const QRect &, | static void drawPolyline( QPainter *, const QPolygonF &pa ); | |||
int peak, int arc, int intervall, const QColor &c1, const QColor &c | static void drawPolyline( QPainter *, const QPointF *, int pointCount ) | |||
2); | ; | |||
static bool d_deviceClipping; | static void drawPoint( QPainter *, double x, double y ); | |||
static QwtMetricsMap d_metricsMap; | static void drawPoint( QPainter *, const QPointF & ); | |||
#if QT_VERSION < 0x040000 | ||||
static bool d_SVGMode; | static void drawPath( QPainter *, const QPainterPath & ); | |||
#endif | static void drawImage( QPainter *, const QRectF &, const QImage & ); | |||
static void drawPixmap( QPainter *, const QRectF &, const QPixmap & ); | ||||
static void drawRoundedFrame( QPainter *, | ||||
const QRectF &, double xRadius, double yRadius, | ||||
const QPalette &, int lineWidth, int frameStyle ); | ||||
static void drawFocusRect( QPainter *, QWidget * ); | ||||
static void drawFocusRect( QPainter *, QWidget *, const QRect & ); | ||||
static void drawColorBar( QPainter *painter, | ||||
const QwtColorMap &, const QwtInterval &, | ||||
const QwtScaleMap &, Qt::Orientation, const QRectF & ); | ||||
static bool isAligning( QPainter *painter ); | ||||
private: | ||||
static bool d_polylineSplitting; | ||||
static bool d_roundingAlignment; | ||||
}; | }; | |||
//! Wrapper for QPainter::drawPoint() | ||||
inline void QwtPainter::drawPoint( QPainter *painter, double x, double y ) | ||||
{ | ||||
QwtPainter::drawPoint( painter, QPointF( x, y ) ); | ||||
} | ||||
//! Wrapper for QPainter::drawLine() | ||||
inline void QwtPainter::drawLine( QPainter *painter, | ||||
double x1, double y1, double x2, double y2 ) | ||||
{ | ||||
QwtPainter::drawLine( painter, QPointF( x1, y1 ), QPointF( x2, y2 ) ); | ||||
} | ||||
//! Wrapper for QPainter::drawLine() | //! Wrapper for QPainter::drawLine() | |||
inline void QwtPainter::drawLine(QPainter *painter, | inline void QwtPainter::drawLine( QPainter *painter, const QLineF &line ) | |||
const QPoint &p1, const QPoint &p2) | ||||
{ | { | |||
drawLine(painter, p1.x(), p1.y(), p2.x(), p2.y()); | QwtPainter::drawLine( painter, line.p1(), line.p2() ); | |||
} | } | |||
/*! | /*! | |||
Returns whether device clipping is enabled. On X11 the default | Returns whether line splitting for the raster paint engine is enabled. | |||
is enabled, otherwise it is disabled. | \sa setPolylineSplitting() | |||
\sa QwtPainter::setDeviceClipping() | ||||
*/ | */ | |||
inline bool QwtPainter::deviceClipping() | inline bool QwtPainter::polylineSplitting() | |||
{ | { | |||
return d_deviceClipping; | return d_polylineSplitting; | |||
} | } | |||
/*! | ||||
Returns whether coordinates should be rounded, before they are painted | ||||
to a paint engine that floors to integer values. For other paint engines | ||||
this ( Pdf, SVG ), this flag has no effect. | ||||
\sa setRoundingAlignment(), isAligning() | ||||
*/ | ||||
inline bool QwtPainter::roundingAlignment() | ||||
{ | ||||
return d_roundingAlignment; | ||||
} | ||||
/*! | ||||
\return roundingAlignment() && isAligning(painter); | ||||
\param painter Painter | ||||
*/ | ||||
inline bool QwtPainter::roundingAlignment(QPainter *painter) | ||||
{ | ||||
return d_roundingAlignment && isAligning(painter); | ||||
} | ||||
#endif | #endif | |||
End of changes. 22 change blocks. | ||||
108 lines changed or deleted | 103 lines changed or added | |||
qwt_panner.h | qwt_panner.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_PANNER_H | #ifndef QWT_PANNER_H | |||
#define QWT_PANNER_H 1 | #define QWT_PANNER_H 1 | |||
#include <qnamespace.h> | ||||
#include <qwidget.h> | ||||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include <qwidget.h> | ||||
#include <qpixmap.h> | ||||
class QCursor; | class QCursor; | |||
/*! | /*! | |||
\brief QwtPanner provides panning of a widget | \brief QwtPanner provides panning of a widget | |||
QwtPanner grabs the contents of a widget, that can be dragged | QwtPanner grabs the contents of a widget, that can be dragged | |||
in all directions. The offset between the start and the end position | in all directions. The offset between the start and the end position | |||
is emitted by the panned signal. | is emitted by the panned signal. | |||
QwtPanner grabs the content of the widget into a pixmap and moves | QwtPanner grabs the content of the widget into a pixmap and moves | |||
the pixmap around, without initiating any repaint events for the widget. | the pixmap around, without initiating any repaint events for the widget. | |||
Areas, that are not part of content are not painted while panning | Areas, that are not part of content are not painted while panning. | |||
in in process. This makes panning fast enough for widgets, where | This makes panning fast enough for widgets, where | |||
repaints are too slow for mouse movements. | repaints are too slow for mouse movements. | |||
For widgets, where repaints are very fast it might be better to | For widgets, where repaints are very fast it might be better to | |||
implement panning manually by mapping mouse events into paint events. | implement panning manually by mapping mouse events into paint events. | |||
*/ | */ | |||
class QWT_EXPORT QwtPanner: public QWidget | class QWT_EXPORT QwtPanner: public QWidget | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
QwtPanner(QWidget* parent); | QwtPanner( QWidget* parent ); | |||
virtual ~QwtPanner(); | virtual ~QwtPanner(); | |||
void setEnabled(bool); | void setEnabled( bool ); | |||
bool isEnabled() const; | bool isEnabled() const; | |||
void setMouseButton(int button, int buttonState = Qt::NoButton); | void setMouseButton( int button, int buttonState = Qt::NoButton ); | |||
void getMouseButton(int &button, int &buttonState) const; | void getMouseButton( int &button, int &buttonState ) const; | |||
void setAbortKey(int key, int state = Qt::NoButton); | void setAbortKey( int key, int state = Qt::NoButton ); | |||
void getAbortKey(int &key, int &state) const; | void getAbortKey( int &key, int &state ) const; | |||
void setCursor(const QCursor &); | void setCursor( const QCursor & ); | |||
const QCursor cursor() const; | const QCursor cursor() const; | |||
#if QT_VERSION >= 0x040000 | void setOrientations( Qt::Orientations ); | |||
void setOrientations(Qt::Orientations); | ||||
Qt::Orientations orientations() const; | Qt::Orientations orientations() const; | |||
#else | ||||
void enableOrientation(Qt::Orientation, bool enable); | ||||
#endif | ||||
bool isOrientationEnabled(Qt::Orientation) const; | bool isOrientationEnabled( Qt::Orientation ) const; | |||
virtual bool eventFilter(QObject *, QEvent *); | virtual bool eventFilter( QObject *, QEvent * ); | |||
signals: | Q_SIGNALS: | |||
/*! | /*! | |||
Signal emitted, when panning is done | Signal emitted, when panning is done | |||
\param dx Offset in horizontal direction | \param dx Offset in horizontal direction | |||
\param dy Offset in vertical direction | \param dy Offset in vertical direction | |||
*/ | */ | |||
void panned(int dx, int dy); | void panned( int dx, int dy ); | |||
/*! | /*! | |||
Signal emitted, while the widget moved, but panning | Signal emitted, while the widget moved, but panning | |||
is not finished. | is not finished. | |||
\param dx Offset in horizontal direction | \param dx Offset in horizontal direction | |||
\param dy Offset in vertical direction | \param dy Offset in vertical direction | |||
*/ | */ | |||
void moved(int dx, int dy); | void moved( int dx, int dy ); | |||
protected: | protected: | |||
virtual void widgetMousePressEvent(QMouseEvent *); | virtual void widgetMousePressEvent( QMouseEvent * ); | |||
virtual void widgetMouseReleaseEvent(QMouseEvent *); | virtual void widgetMouseReleaseEvent( QMouseEvent * ); | |||
virtual void widgetMouseMoveEvent(QMouseEvent *); | virtual void widgetMouseMoveEvent( QMouseEvent * ); | |||
virtual void widgetKeyPressEvent(QKeyEvent *); | virtual void widgetKeyPressEvent( QKeyEvent * ); | |||
virtual void widgetKeyReleaseEvent(QKeyEvent *); | virtual void widgetKeyReleaseEvent( QKeyEvent * ); | |||
virtual void paintEvent( QPaintEvent * ); | ||||
virtual void paintEvent(QPaintEvent *); | virtual QBitmap contentsMask() const; | |||
virtual QPixmap grab() const; | ||||
private: | private: | |||
#ifndef QT_NO_CURSOR | #ifndef QT_NO_CURSOR | |||
void showCursor(bool); | void showCursor( bool ); | |||
#endif | #endif | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 17 change blocks. | ||||
28 lines changed or deleted | 27 lines changed or added | |||
qwt_picker.h | qwt_picker.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_PICKER | #ifndef QWT_PICKER | |||
#define QWT_PICKER 1 | #define QWT_PICKER 1 | |||
#include "qwt_global.h" | ||||
#include "qwt_text.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 "qwt_global.h" | ||||
#include "qwt_text.h" | ||||
#include "qwt_polygon.h" | ||||
#include "qwt_event_pattern.h" | ||||
class QWidget; | class QWidget; | |||
class QMouseEvent; | class QMouseEvent; | |||
class QWheelEvent; | class QWheelEvent; | |||
class QKeyEvent; | class QKeyEvent; | |||
class QwtPickerMachine; | class QwtPickerMachine; | |||
/*! | /*! | |||
\brief QwtPicker provides selections on a widget | \brief QwtPicker provides selections on a widget | |||
QwtPicker filters all 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. Depending | and translates them into an array of selected points. | |||
on the QwtPicker::SelectionType the selection might be a single point, | ||||
a rectangle or a polygon. The selection process is supported by | The way how the points are collected depends on type of state machine | |||
optional rubberbands (rubberband selection) and position trackers. | that is connected to the picker. Qwt offers a couple of predefined | |||
state machines for selecting: | ||||
QwtPicker is useful for widgets where the event handlers | ||||
can't be overloaded, like for components of composite widgets. | - Nothing\n | |||
It offers alternative handlers for mouse and key events. | QwtPickerTrackerMachine | |||
- Single points\n | ||||
QwtPickerClickPointMachine, QwtPickerDragPointMachine | ||||
- Rectangles\n | ||||
QwtPickerClickRectMachine, QwtPickerDragRectMachine | ||||
- Polygons\n | ||||
QwtPickerPolygonMachine | ||||
While these state machines cover the most common ways to collect points | ||||
it is also possible to implement individual machines as well. | ||||
QwtPicker translates the picked points into a selection using the | ||||
adjustedPoints method. adjustedPoints is intended to be reimplemented | ||||
to fixup the selection according to application specific requirements. | ||||
(F.e. when an application accepts rectangles of a fixed aspect ratio only | ||||
.) | ||||
Optionally QwtPicker support the process of collecting points by a | ||||
rubberband and tracker displaying a text for the current mouse | ||||
position. | ||||
\par Example | \par Example | |||
\verbatim #include <qwt_picker.h> | \verbatim #include <qwt_picker.h> | |||
#include <qwt_picker_machine.h> | ||||
QwtPicker *picker = new QwtPicker(widget); | QwtPicker *picker = new QwtPicker(widget); | |||
picker->setStateMachine(new QwtPickerDragRectMachine); | ||||
picker->setTrackerMode(QwtPicker::ActiveOnly); | picker->setTrackerMode(QwtPicker::ActiveOnly); | |||
connect(picker, SIGNAL(selected(const QwtPolygon &)), ...); | ||||
// emit the position of clicks on widget | ||||
picker->setSelectionFlags(QwtPicker::PointSelection | QwtPicker::ClickSelec | ||||
tion); | ||||
... | ||||
// now select rectangles | ||||
picker->setSelectionFlags(QwtPicker::RectSelection | QwtPicker::DragSelecti | ||||
on); | ||||
picker->setRubberBand(QwtPicker::RectRubberBand); \endverbatim\n | picker->setRubberBand(QwtPicker::RectRubberBand); \endverbatim\n | |||
The selection process uses the commands begin(), append(), move() and end | The state machine triggers the following commands: | |||
(). | ||||
append() adds a new point to the selection, move() changes the position o | - begin()\n | |||
f | Activate/Initialize the selection. | |||
the latest point. | - append()\n | |||
Add a new point | ||||
The commands are initiated from a small state machine (QwtPickerMachine) | - move() \n | |||
that translates mouse and key events. There are a couple of predefined | Change the position of the last point. | |||
state machines for point, rect and polygon selections. The selectionFlags | - remove()\n | |||
() | Remove the last point. | |||
control which one should be used. It is possible to use other machines | - end()\n | |||
by overloading stateMachine(). | 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 rubberband 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 for ClickSelection while the picker is activ e, | 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 ) | |||
Q_ENUMS(DisplayMode) | Q_ENUMS( DisplayMode ) | |||
Q_ENUMS(ResizeMode) | Q_ENUMS( ResizeMode ) | |||
Q_PROPERTY(int selectionFlags READ selectionFlags WRITE setSelectionFla | Q_PROPERTY( bool isEnabled READ isEnabled WRITE setEnabled ) | |||
gs) | Q_PROPERTY( ResizeMode resizeMode READ resizeMode WRITE setResizeMode ) | |||
Q_PROPERTY(DisplayMode trackerMode READ trackerMode WRITE setTrackerMod | ||||
e) | Q_PROPERTY( DisplayMode trackerMode READ trackerMode WRITE setTrackerMo | |||
Q_PROPERTY(QFont trackerFont READ trackerFont WRITE setTrackerFont) | de ) | |||
Q_PROPERTY(RubberBand rubberBand READ rubberBand WRITE setRubberBand) | Q_PROPERTY( QPen trackerPen READ trackerPen WRITE setTrackerPen ) | |||
Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode) | Q_PROPERTY( QFont trackerFont READ trackerFont WRITE setTrackerFont ) | |||
Q_PROPERTY(bool isEnabled READ isEnabled WRITE setEnabled) | ||||
Q_PROPERTY(QPen trackerPen READ trackerPen WRITE setTrackerPen) | Q_PROPERTY( RubberBand rubberBand READ rubberBand WRITE setRubberBand ) | |||
Q_PROPERTY(QPen rubberBandPen READ rubberBandPen WRITE setRubberBandPen | Q_PROPERTY( QPen rubberBandPen READ rubberBandPen WRITE setRubberBandPe | |||
) | n ) | |||
public: | public: | |||
/*! | /*! | |||
This enum type describes the type of a selection. It can be or'd | ||||
with QwtPicker::RectSelectionType and QwtPicker::SelectionMode | ||||
and passed to QwtPicker::setSelectionFlags() | ||||
- NoSelection\n | ||||
Selection is disabled. Note this is different to the disabled | ||||
state, as you might have a tracker. | ||||
- PointSelection\n | ||||
Select a single point. | ||||
- RectSelection\n | ||||
Select a rectangle. | ||||
- PolygonSelection\n | ||||
Select a polygon. | ||||
The default value is NoSelection. | ||||
\sa QwtPicker::setSelectionFlags(), QwtPicker::selectionFlags() | ||||
*/ | ||||
enum SelectionType | ||||
{ | ||||
NoSelection = 0, | ||||
PointSelection = 1, | ||||
RectSelection = 2, | ||||
PolygonSelection = 4 | ||||
}; | ||||
/*! | ||||
\brief Selection subtype for RectSelection | ||||
This enum type describes the type of rectangle selections. | ||||
It can be or'd with QwtPicker::RectSelectionType and | ||||
QwtPicker::SelectionMode and passed to QwtPicker::setSelectionFlags() | ||||
. | ||||
- CornerToCorner\n | ||||
The first and the second selected point are the corners | ||||
of the rectangle. | ||||
- CenterToCorner\n | ||||
The first point is the center, the second a corner of the | ||||
rectangle. | ||||
- CenterToRadius\n | ||||
The first point is the center of a quadrat, calculated by the maxim | ||||
um | ||||
of the x- and y-distance. | ||||
The default value is CornerToCorner. | ||||
\sa QwtPicker::setSelectionFlags(), QwtPicker::selectionFlags() | ||||
*/ | ||||
enum RectSelectionType | ||||
{ | ||||
CornerToCorner = 64, | ||||
CenterToCorner = 128, | ||||
CenterToRadius = 256 | ||||
}; | ||||
/*! | ||||
Values of this enum type or'd together with a SelectionType value | ||||
identifies which state machine should be used for the selection. | ||||
The default value is ClickSelection. | ||||
\sa stateMachine() | ||||
*/ | ||||
enum SelectionMode | ||||
{ | ||||
ClickSelection = 1024, | ||||
DragSelection = 2048 | ||||
}; | ||||
/*! | ||||
Rubberband style | Rubberband style | |||
- NoRubberBand\n | ||||
No rubberband. | ||||
- HLineRubberBand & PointSelection\n | ||||
A horizontal line. | ||||
- VLineRubberBand & PointSelection\n | ||||
A vertical line. | ||||
- CrossRubberBand & PointSelection\n | ||||
A horizontal and a vertical line. | ||||
- RectRubberBand & RectSelection\n | ||||
A rectangle. | ||||
- EllipseRubberBand & RectSelection\n | ||||
An ellipse. | ||||
- PolygonRubberBand &PolygonSelection\n | ||||
A polygon. | ||||
- UserRubberBand\n | ||||
Values >= UserRubberBand can be used to define additional | ||||
rubber bands. | ||||
The default value is NoRubberBand. | The default value is QwtPicker::NoRubberBand. | |||
\sa QwtPicker::setRubberBand(), QwtPicker::rubberBand() | \sa setRubberBand(), rubberBand() | |||
*/ | */ | |||
enum RubberBand | enum RubberBand | |||
{ | { | |||
//! No rubberband. | ||||
NoRubberBand = 0, | NoRubberBand = 0, | |||
// Point | //! A horizontal line ( only for QwtPicker::PointSelection ) | |||
HLineRubberBand, | HLineRubberBand, | |||
//! A vertical line ( only for QwtPicker::PointSelection ) | ||||
VLineRubberBand, | VLineRubberBand, | |||
//! A crosshair ( only for QwtPicker::PointSelection ) | ||||
CrossRubberBand, | CrossRubberBand, | |||
// Rect | //! A rectangle ( only for QwtPicker::RectSelection ) | |||
RectRubberBand, | RectRubberBand, | |||
//! An ellipse ( only for QwtPicker::RectSelection ) | ||||
EllipseRubberBand, | EllipseRubberBand, | |||
// Polygon | //! A polygon ( only for QwtPicker::&PolygonSelection ) | |||
PolygonRubberBand, | PolygonRubberBand, | |||
/*! | ||||
Values >= UserRubberBand can be used to define additional | ||||
rubber bands. | ||||
*/ | ||||
UserRubberBand = 100 | UserRubberBand = 100 | |||
}; | }; | |||
/*! | /*! | |||
- AlwaysOff\n | \brief Display mode | |||
Display never. | \sa setTrackerMode(), trackerMode(), isActive() | |||
- AlwaysOn\n | ||||
Display always. | ||||
- ActiveOnly\n | ||||
Display only when the selection is active. | ||||
\sa QwtPicker::setTrackerMode(), QwtPicker::trackerMode(), | ||||
QwtPicker::isActive() | ||||
*/ | */ | |||
enum DisplayMode | enum DisplayMode | |||
{ | { | |||
//! Display never | ||||
AlwaysOff, | AlwaysOff, | |||
//! Display always | ||||
AlwaysOn, | AlwaysOn, | |||
//! Display only when the selection is active | ||||
ActiveOnly | ActiveOnly | |||
}; | }; | |||
/*! | /*! | |||
Controls what to do with the selected points of an active | Controls what to do with the selected points of an active | |||
selection when the observed widget is resized. | selection when the observed widget is resized. | |||
- Stretch\n | ||||
All points are scaled according to the new size, | ||||
- KeepSize\n | ||||
All points remain unchanged. | ||||
The default value is Stretch. | The default value is QwtPicker::Stretch. | |||
\sa QwtPicker::setResizeMode(), QwtPicker::resize() | \sa setResizeMode() | |||
*/ | */ | |||
enum ResizeMode | enum ResizeMode | |||
{ | { | |||
//! All points are scaled according to the new size, | ||||
Stretch, | Stretch, | |||
//! All points remain unchanged. | ||||
KeepSize | KeepSize | |||
}; | }; | |||
explicit QwtPicker(QWidget *parent); | explicit QwtPicker( QWidget *parent ); | |||
explicit QwtPicker(int selectionFlags, RubberBand rubberBand, | explicit QwtPicker( RubberBand rubberBand, | |||
DisplayMode trackerMode, QWidget *); | DisplayMode trackerMode, QWidget * ); | |||
virtual ~QwtPicker(); | virtual ~QwtPicker(); | |||
virtual void setSelectionFlags(int); | void setStateMachine( QwtPickerMachine * ); | |||
int selectionFlags() const; | const QwtPickerMachine *stateMachine() const; | |||
QwtPickerMachine *stateMachine(); | ||||
virtual void setRubberBand(RubberBand); | void setRubberBand( RubberBand ); | |||
RubberBand rubberBand() const; | RubberBand rubberBand() const; | |||
virtual void setTrackerMode(DisplayMode); | void setTrackerMode( DisplayMode ); | |||
DisplayMode trackerMode() const; | DisplayMode trackerMode() const; | |||
virtual void setResizeMode(ResizeMode); | void setResizeMode( ResizeMode ); | |||
ResizeMode resizeMode() const; | ResizeMode resizeMode() const; | |||
virtual void setRubberBandPen(const QPen &); | void setRubberBandPen( const QPen & ); | |||
QPen rubberBandPen() const; | QPen rubberBandPen() const; | |||
virtual void setTrackerPen(const QPen &); | void setTrackerPen( const QPen & ); | |||
QPen trackerPen() const; | QPen trackerPen() const; | |||
virtual void setTrackerFont(const QFont &); | void setTrackerFont( const QFont & ); | |||
QFont trackerFont() const; | QFont trackerFont() const; | |||
bool isEnabled() const; | bool isEnabled() const; | |||
virtual void setEnabled(bool); | ||||
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 QRect pickRect() const; | |||
const QwtPolygon &selection() const; | ||||
virtual void drawRubberBand(QPainter *) const; | virtual void drawRubberBand( QPainter * ) const; | |||
virtual void drawTracker(QPainter *) const; | virtual void drawTracker( QPainter * ) const; | |||
virtual QwtText trackerText(const QPoint &pos) const; | virtual QwtText trackerText( const QPoint &pos ) const; | |||
QPoint trackerPosition() const; | QPoint trackerPosition() const; | |||
QRect trackerRect(const QFont &) const; | virtual QRect trackerRect( const QFont & ) const; | |||
QPolygon selection() const; | ||||
public Q_SLOTS: | ||||
void setEnabled( bool ); | ||||
Q_SIGNALS: | ||||
/*! | ||||
A signal indicating, when the picker has been activated. | ||||
Together with setEnabled() it can be used to implement | ||||
selections with more than one picker. | ||||
\param on True, when the picker has been activated | ||||
*/ | ||||
void activated( bool on ); | ||||
signals: | ||||
/*! | /*! | |||
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 polygon Selected points | |||
*/ | */ | |||
void selected(const QwtPolygon &pa); | void selected( const QPolygon &polygon ); | |||
/*! | /*! | |||
A signal emitted when a point has been appended to the selection | A signal emitted when a point has been appended to the selection | |||
\param pos Position of the appended point. | \param pos Position of the appended point. | |||
\sa append(). moved() | \sa append(). moved() | |||
*/ | */ | |||
void appended(const QPoint &pos); | void appended( 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 moved. | selection has been moved. | |||
\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 | ||||
selection has been removed. | ||||
\sa remove(), appended() | ||||
*/ | ||||
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 pa Changed selection | \param selection Changed selection | |||
\sa stretchSelection() | \sa stretchSelection() | |||
*/ | */ | |||
void changed(const QwtPolygon &pa); | void changed( const QPolygon &selection ); | |||
protected: | protected: | |||
/*! | virtual QPolygon adjustedPoints( const QPolygon & ) const; | |||
\brief Validate and fixup the selection | ||||
Accepts all selections unmodified | ||||
\param selection Selection to validate and fixup | ||||
\return true, when accepted, false otherwise | ||||
*/ | ||||
virtual bool accept(QwtPolygon &selection) const; | ||||
virtual void transition(const QEvent *); | virtual void transition( const QEvent * ); | |||
virtual void begin(); | virtual void begin(); | |||
virtual void append(const QPoint &); | virtual void append( const QPoint & ); | |||
virtual void move(const QPoint &); | virtual void move( const QPoint & ); | |||
virtual bool end(bool ok = true); | virtual void remove(); | |||
virtual bool end( bool ok = true ); | ||||
virtual bool accept( QPolygon & ) const; | ||||
virtual void reset(); | virtual void reset(); | |||
virtual void widgetMousePressEvent(QMouseEvent *); | virtual void widgetMousePressEvent( QMouseEvent * ); | |||
virtual void widgetMouseReleaseEvent(QMouseEvent *); | virtual void widgetMouseReleaseEvent( QMouseEvent * ); | |||
virtual void widgetMouseDoubleClickEvent(QMouseEvent *); | virtual void widgetMouseDoubleClickEvent( QMouseEvent * ); | |||
virtual void widgetMouseMoveEvent(QMouseEvent *); | virtual void widgetMouseMoveEvent( QMouseEvent * ); | |||
virtual void widgetWheelEvent(QWheelEvent *); | virtual void widgetWheelEvent( QWheelEvent * ); | |||
virtual void widgetKeyPressEvent(QKeyEvent *); | virtual void widgetKeyPressEvent( QKeyEvent * ); | |||
virtual void widgetKeyReleaseEvent(QKeyEvent *); | virtual void widgetKeyReleaseEvent( QKeyEvent * ); | |||
virtual void widgetLeaveEvent(QEvent *); | virtual void widgetEnterEvent( QEvent * ); | |||
virtual void widgetLeaveEvent( QEvent * ); | ||||
virtual void stretchSelection(const QSize &oldSize, | ||||
const QSize &newSize); | ||||
virtual QwtPickerMachine *stateMachine(int) const; | virtual void stretchSelection( const QSize &oldSize, | |||
const QSize &newSize ); | ||||
virtual void updateDisplay(); | virtual void updateDisplay(); | |||
const QWidget *rubberBandWidget() const; | const QWidget *rubberBandWidget() const; | |||
const QWidget *trackerWidget() const; | const QWidget *trackerWidget() const; | |||
const QPolygon &pickedPoints() const; | ||||
private: | private: | |||
void init(QWidget *, int selectionFlags, RubberBand rubberBand, | void init( QWidget *, RubberBand rubberBand, DisplayMode trackerMode ); | |||
DisplayMode trackerMode); | ||||
void setStateMachine(QwtPickerMachine *); | void setMouseTracking( bool ); | |||
void setMouseTracking(bool); | ||||
class PickerWidget; | class PickerWidget; | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 60 change blocks. | ||||
210 lines changed or deleted | 155 lines changed or added | |||
qwt_picker_machine.h | qwt_picker_machine.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_PICKER_MACHINE | #ifndef QWT_PICKER_MACHINE | |||
#define QWT_PICKER_MACHINE 1 | #define QWT_PICKER_MACHINE 1 | |||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#if QT_VERSION < 0x040000 | ||||
#include <qvaluelist.h> | ||||
#else | ||||
#include <qlist.h> | #include <qlist.h> | |||
#endif | ||||
class QEvent; | class QEvent; | |||
class QwtEventPattern; | class QwtEventPattern; | |||
/*! | /*! | |||
\brief A state machine for QwtPicker selections | \brief A state machine for QwtPicker selections | |||
QwtPickerMachine accepts key and mouse events and translates them | QwtPickerMachine accepts key and mouse events and translates them | |||
into selection commands. | into selection commands. | |||
\sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode | \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode | |||
*/ | */ | |||
class QWT_EXPORT QwtPickerMachine | class QWT_EXPORT QwtPickerMachine | |||
{ | { | |||
public: | public: | |||
//! Commands - the output of the state machine | /*! | |||
Type of a selection. | ||||
\sa selectionType() | ||||
*/ | ||||
enum SelectionType | ||||
{ | ||||
//! The state machine not usable for any type of selection. | ||||
NoSelection = -1, | ||||
//! The state machine is for selecting a single point. | ||||
PointSelection, | ||||
//! The state machine is for selecting a rectangle (2 points). | ||||
RectSelection, | ||||
//! The state machine is for selecting a polygon (many points). | ||||
PolygonSelection | ||||
}; | ||||
//! Commands - the output of a state machine | ||||
enum Command | enum Command | |||
{ | { | |||
Begin, | Begin, | |||
Append, | Append, | |||
Move, | Move, | |||
Remove, | ||||
End | End | |||
}; | }; | |||
#if QT_VERSION < 0x040000 | QwtPickerMachine( SelectionType ); | |||
typedef QValueList<Command> CommandList; | ||||
#else | ||||
typedef QList<Command> CommandList; | ||||
#endif | ||||
virtual ~QwtPickerMachine(); | virtual ~QwtPickerMachine(); | |||
//! Transition | //! Transition | |||
virtual CommandList transition( | virtual QList<Command> transition( | |||
const QwtEventPattern &, const QEvent *) = 0; | const QwtEventPattern &, const QEvent * ) = 0; | |||
void reset(); | void reset(); | |||
int state() const; | int state() const; | |||
void setState(int); | void setState( int ); | |||
protected: | SelectionType selectionType() const; | |||
QwtPickerMachine(); | ||||
private: | private: | |||
const SelectionType d_selectionType; | ||||
int d_state; | int d_state; | |||
}; | }; | |||
/*! | /*! | |||
\brief A state machine for indicating mouse movements | ||||
QwtPickerTrackerMachine supports displaying information | ||||
corresponding to mouse movements, but is not intended for | ||||
selecting anything. Begin/End are related to Enter/Leave events. | ||||
*/ | ||||
class QWT_EXPORT QwtPickerTrackerMachine: public QwtPickerMachine | ||||
{ | ||||
public: | ||||
QwtPickerTrackerMachine(); | ||||
virtual QList<Command> transition( | ||||
const QwtEventPattern &, const QEvent * ); | ||||
}; | ||||
/*! | ||||
\brief A state machine for point selections | \brief A state machine for point selections | |||
Pressing QwtEventPattern::MouseSelect1 or | Pressing QwtEventPattern::MouseSelect1 or | |||
QwtEventPattern::KeySelect1 selects a point. | QwtEventPattern::KeySelect1 selects a point. | |||
\sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode | \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode | |||
*/ | */ | |||
class QWT_EXPORT QwtPickerClickPointMachine: public QwtPickerMachine | class QWT_EXPORT QwtPickerClickPointMachine: public QwtPickerMachine | |||
{ | { | |||
public: | public: | |||
virtual CommandList transition( | QwtPickerClickPointMachine(); | |||
const QwtEventPattern &, const QEvent *); | ||||
virtual QList<Command> transition( | ||||
const QwtEventPattern &, const QEvent * ); | ||||
}; | }; | |||
/*! | /*! | |||
\brief A state machine for point selections | \brief A state machine for point selections | |||
Pressing QwtEventPattern::MouseSelect1 or QwtEventPattern::KeySelect1 | Pressing QwtEventPattern::MouseSelect1 or QwtEventPattern::KeySelect1 | |||
starts the selection, releasing QwtEventPattern::MouseSelect1 or | starts the selection, releasing QwtEventPattern::MouseSelect1 or | |||
a second press of QwtEventPattern::KeySelect1 terminates it. | a second press of QwtEventPattern::KeySelect1 terminates it. | |||
*/ | */ | |||
class QWT_EXPORT QwtPickerDragPointMachine: public QwtPickerMachine | class QWT_EXPORT QwtPickerDragPointMachine: public QwtPickerMachine | |||
{ | { | |||
public: | public: | |||
virtual CommandList transition( | QwtPickerDragPointMachine(); | |||
const QwtEventPattern &, const QEvent *); | ||||
virtual QList<Command> transition( | ||||
const QwtEventPattern &, const QEvent * ); | ||||
}; | }; | |||
/*! | /*! | |||
\brief A state machine for rectangle selections | \brief A state machine for rectangle selections | |||
Pressing QwtEventPattern::MouseSelect1 starts | Pressing QwtEventPattern::MouseSelect1 starts | |||
the selection, releasing it selects the first point. Pressing it | the selection, releasing it selects the first point. Pressing it | |||
again selects the second point and terminates the selection. | again selects the second point and terminates the selection. | |||
Pressing QwtEventPattern::KeySelect1 also starts the | Pressing QwtEventPattern::KeySelect1 also starts the | |||
selection, a second press selects the first point. A third one selects | selection, a second press selects the first point. A third one selects | |||
the second point and terminates the selection. | the second point and terminates the selection. | |||
\sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode | \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode | |||
*/ | */ | |||
class QWT_EXPORT QwtPickerClickRectMachine: public QwtPickerMachine | class QWT_EXPORT QwtPickerClickRectMachine: public QwtPickerMachine | |||
{ | { | |||
public: | public: | |||
virtual CommandList transition( | QwtPickerClickRectMachine(); | |||
const QwtEventPattern &, const QEvent *); | ||||
virtual QList<Command> transition( | ||||
const QwtEventPattern &, const QEvent * ); | ||||
}; | }; | |||
/*! | /*! | |||
\brief A state machine for rectangle selections | \brief A state machine for rectangle selections | |||
Pressing QwtEventPattern::MouseSelect1 selects | Pressing QwtEventPattern::MouseSelect1 selects | |||
the first point, releasing it the second point. | the first point, releasing it the second point. | |||
Pressing QwtEventPattern::KeySelect1 also selects the | Pressing QwtEventPattern::KeySelect1 also selects the | |||
first point, a second press selects the second point and terminates | first point, a second press selects the second point and terminates | |||
the selection. | the selection. | |||
\sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode | \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode | |||
*/ | */ | |||
class QWT_EXPORT QwtPickerDragRectMachine: public QwtPickerMachine | class QWT_EXPORT QwtPickerDragRectMachine: public QwtPickerMachine | |||
{ | { | |||
public: | public: | |||
virtual CommandList transition( | QwtPickerDragRectMachine(); | |||
const QwtEventPattern &, const QEvent *); | ||||
virtual QList<Command> transition( | ||||
const QwtEventPattern &, const QEvent * ); | ||||
}; | }; | |||
/*! | /*! | |||
\brief A state machine for polygon selections | \brief A state machine for polygon selections | |||
Pressing QwtEventPattern::MouseSelect1 or QwtEventPattern::KeySelect1 | Pressing QwtEventPattern::MouseSelect1 or QwtEventPattern::KeySelect1 | |||
starts the selection and selects the first point, or appends a point. | starts the selection and selects the first point, or appends a point. | |||
Pressing QwtEventPattern::MouseSelect2 or QwtEventPattern::KeySelect2 | Pressing QwtEventPattern::MouseSelect2 or QwtEventPattern::KeySelect2 | |||
appends the last point and terminates the selection. | appends the last point and terminates the selection. | |||
\sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode | \sa QwtEventPattern::MousePatternCode, QwtEventPattern::KeyPatternCode | |||
*/ | */ | |||
class QWT_EXPORT QwtPickerPolygonMachine: public QwtPickerMachine | class QWT_EXPORT QwtPickerPolygonMachine: public QwtPickerMachine | |||
{ | { | |||
public: | public: | |||
virtual CommandList transition( | QwtPickerPolygonMachine(); | |||
const QwtEventPattern &, const QEvent *); | ||||
virtual QList<Command> transition( | ||||
const QwtEventPattern &, const QEvent * ); | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 15 change blocks. | ||||
26 lines changed or deleted | 63 lines changed or added | |||
qwt_plot.h | qwt_plot.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_H | #ifndef QWT_PLOT_H | |||
#define QWT_PLOT_H | #define QWT_PLOT_H | |||
#include <qframe.h> | ||||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include "qwt_array.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_plot_printfilter.h" | #include "qwt_interval.h" | |||
#include <qframe.h> | ||||
class QwtPlotLayout; | class QwtPlotLayout; | |||
class QwtLegend; | class QwtLegend; | |||
class QwtScaleWidget; | class QwtScaleWidget; | |||
class QwtScaleEngine; | class QwtScaleEngine; | |||
class QwtScaleDiv; | class QwtScaleDiv; | |||
class QwtScaleDraw; | class QwtScaleDraw; | |||
class QwtTextLabel; | class QwtTextLabel; | |||
class QwtPlotCanvas; | class QwtPlotCanvas; | |||
class QwtPlotPrintFilter; | ||||
/*! | /*! | |||
\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 | |||
skipping to change at line 79 | skipping to change at line 77 | |||
\endverbatim | \endverbatim | |||
*/ | */ | |||
class QWT_EXPORT QwtPlot: public QFrame, public QwtPlotDict | class QWT_EXPORT QwtPlot: public QFrame, public QwtPlotDict | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
Q_PROPERTY( QString propertiesDocument | Q_PROPERTY( QString propertiesDocument | |||
READ grabProperties WRITE applyProperties ) | READ grabProperties WRITE applyProperties ) | |||
public: | public: | |||
/*! | //! \brief Axis index | |||
Axis index | ||||
- yLeft\n | ||||
- yRight\n | ||||
- xBottom\n | ||||
- xTop\n | ||||
*/ | ||||
enum Axis | enum Axis | |||
{ | { | |||
//! Y axis left of the canvas | ||||
yLeft, | yLeft, | |||
//! Y axis right of the canvas | ||||
yRight, | yRight, | |||
//! X axis below the canvas | ||||
xBottom, | xBottom, | |||
//! X axis above the canvas | ||||
xTop, | xTop, | |||
//! Number of axes | ||||
axisCnt | axisCnt | |||
}; | }; | |||
/*! | /*! | |||
Position of the legend, relative to the canvas. | Position of the legend, relative to the canvas. | |||
- LeftLegend\n | ||||
The legend will be left from the yLeft axis. | ||||
- RightLegend\n | ||||
The legend will be right from the yLeft axis. | ||||
- BottomLegend\n | ||||
The legend will be right below the xBottom axis. | ||||
- TopLegend\n | ||||
The legend will be between xTop axis and the title. | ||||
- ExternalLegend\n | ||||
External means that only the content of the legend | ||||
will be handled by QwtPlot, but not its geometry. | ||||
This might be interesting if an application wants to | ||||
have a legend in an external window ( or on the canvas ). | ||||
\note In case of ExternalLegend, the legend is not | ||||
printed by print(). | ||||
\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. | ||||
LeftLegend, | LeftLegend, | |||
//! The legend will be right from the QwtPlot::yRight axis. | ||||
RightLegend, | RightLegend, | |||
//! The legend will be below QwtPlot::xBottom axis. | ||||
BottomLegend, | BottomLegend, | |||
//! The legend will be between QwtPlot::xTop axis and 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 | ExternalLegend | |||
}; | }; | |||
explicit QwtPlot(QWidget * = NULL); | explicit QwtPlot( QWidget * = NULL ); | |||
explicit QwtPlot(const QwtText &title, QWidget *p = NULL); | explicit QwtPlot( const QwtText &title, QWidget *p = NULL ); | |||
#if QT_VERSION < 0x040000 | ||||
explicit QwtPlot(QWidget *, const char* name); | ||||
#endif | ||||
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 tf = true ); | |||
bool autoReplot() const; | bool autoReplot() const; | |||
void print(QPaintDevice &p, | ||||
const QwtPlotPrintFilter & = QwtPlotPrintFilter()) const; | ||||
virtual void print(QPainter *, const QRect &rect, | ||||
const QwtPlotPrintFilter & = QwtPlotPrintFilter()) const; | ||||
// Layout | // Layout | |||
QwtPlotLayout *plotLayout(); | QwtPlotLayout *plotLayout(); | |||
const QwtPlotLayout *plotLayout() const; | const QwtPlotLayout *plotLayout() const; | |||
void setMargin(int margin); | ||||
int margin() 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; | |||
// Canvas | // Canvas | |||
QwtPlotCanvas *canvas(); | QwtPlotCanvas *canvas(); | |||
const QwtPlotCanvas *canvas() const; | const QwtPlotCanvas *canvas() const; | |||
void setCanvasBackground (const QColor &c); | void setCanvasBackground( const QBrush & ); | |||
const QColor& canvasBackground() const; | QBrush canvasBackground() const; | |||
void setCanvasLineWidth(int w); | void setCanvasLineWidth( int w ); | |||
int canvasLineWidth() const; | 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; | |||
int 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 * ); | |||
void setAxisAutoScale(int axisId); | void setAxisAutoScale( int axisId, bool on = true ); | |||
bool axisAutoScale(int axisId) const; | bool axisAutoScale( int axisId ) const; | |||
void enableAxis(int axisId, bool tf = true); | void enableAxis( int axisId, bool tf = true ); | |||
bool axisEnabled(int axisId) const; | bool axisEnabled( int axisId ) const; | |||
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 setAxisScaleDraw(int axisId, QwtScaleDraw *); | void setAxisScaleDiv( int axisId, const QwtScaleDiv & ); | |||
void setAxisScaleDraw( int axisId, QwtScaleDraw * ); | ||||
double axisStepSize(int axisId) const; | double axisStepSize( int axisId ) const; | |||
QwtInterval axisInterval( int axisId ) const; | ||||
const QwtScaleDiv *axisScaleDiv(int axisId) const; | const QwtScaleDiv *axisScaleDiv( int axisId ) const; | |||
QwtScaleDiv *axisScaleDiv(int axisId); | 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 ); | |||
#if QT_VERSION < 0x040000 | void setAxisLabelAlignment( int axisId, Qt::Alignment ); | |||
void setAxisLabelAlignment(int axisId, int); | void setAxisLabelRotation( int axisId, double rotation ); | |||
#else | ||||
void setAxisLabelAlignment(int axisId, Qt::Alignment); | void setAxisTitle( int axisId, const QString & ); | |||
#endif | void setAxisTitle( int axisId, const QwtText & ); | |||
void setAxisLabelRotation(int axisId, double rotation); | QwtText axisTitle( int axisId ) const; | |||
void setAxisMaxMinor( int axisId, int maxMinor ); | ||||
int axisMaxMinor( int axisId ) const; | ||||
void setAxisTitle(int axisId, const QString &); | void setAxisMaxMajor( int axisId, int maxMajor ); | |||
void setAxisTitle(int axisId, const QwtText &); | int axisMaxMajor( int axisId ) const; | |||
QwtText axisTitle(int axisId) const; | ||||
void setAxisMaxMinor(int axisId, int maxMinor); | ||||
int axisMaxMajor(int axisId) const; | ||||
void setAxisMaxMajor(int axisId, int maxMajor); | ||||
int axisMaxMinor(int axisId) const; | ||||
// Legend | // Legend | |||
void insertLegend(QwtLegend *, LegendPosition = QwtPlot::RightLegend, | void insertLegend( QwtLegend *, LegendPosition = QwtPlot::RightLegend, | |||
double ratio = -1.0); | double ratio = -1.0 ); | |||
QwtLegend *legend(); | QwtLegend *legend(); | |||
const QwtLegend *legend() const; | const QwtLegend *legend() const; | |||
// Misc | // Misc | |||
virtual void polish(); | ||||
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(); | |||
virtual bool event(QEvent *); | virtual bool event( QEvent * ); | |||
signals: | virtual void drawItems( QPainter *, const QRectF &, | |||
const QwtScaleMap maps[axisCnt] ) const; | ||||
Q_SIGNALS: | ||||
/*! | /*! | |||
A signal which is emitted when the user has clicked on | A signal which is emitted when the user has clicked on | |||
a legend item, which is in QwtLegend::ClickableItem mode. | a legend item, which is in QwtLegend::ClickableItem mode. | |||
\param plotItem Corresponding plot item of the | \param plotItem Corresponding plot item of the | |||
selected legend item | selected legend item | |||
\note clicks are disabled as default | \note clicks are disabled as default | |||
\sa QwtLegend::setItemMode(), QwtLegend::itemMode() | \sa QwtLegend::setItemMode(), QwtLegend::itemMode() | |||
*/ | */ | |||
void legendClicked(QwtPlotItem *plotItem); | void legendClicked( QwtPlotItem *plotItem ); | |||
/*! | /*! | |||
A signal which is emitted when the user has clicked on | A signal which is emitted when the user has clicked on | |||
a legend item, which is in QwtLegend::CheckableItem mode | a legend item, which is in QwtLegend::CheckableItem mode | |||
\param plotItem Corresponding plot item of the | \param plotItem Corresponding plot item of the | |||
selected legend item | selected legend item | |||
\param on True when the legen item is checked | \param on True when the legen item is checked | |||
\note clicks are disabled as default | \note clicks are disabled as default | |||
\sa QwtLegend::setItemMode(), QwtLegend::itemMode() | \sa QwtLegend::setItemMode(), QwtLegend::itemMode() | |||
*/ | */ | |||
void legendChecked(QwtPlotItem *plotItem, bool on); | void legendChecked( QwtPlotItem *plotItem, bool on ); | |||
public slots: | ||||
virtual void clear(); | ||||
public Q_SLOTS: | ||||
virtual void replot(); | virtual void replot(); | |||
void autoRefresh(); | void autoRefresh(); | |||
protected slots: | protected Q_SLOTS: | |||
virtual void legendItemClicked(); | virtual void legendItemClicked(); | |||
virtual void legendItemChecked(bool); | virtual void legendItemChecked( bool ); | |||
protected: | protected: | |||
static bool axisValid(int axisId); | static bool axisValid( int axisId ); | |||
virtual void drawItems(QPainter *, const QRect &, | ||||
const QwtScaleMap maps[axisCnt], | ||||
const QwtPlotPrintFilter &) const; | ||||
virtual void updateTabOrder(); | virtual void updateTabOrder(); | |||
virtual void resizeEvent(QResizeEvent *e); | virtual void resizeEvent( QResizeEvent *e ); | |||
virtual void printLegendItem(QPainter *, | ||||
const QWidget *, const QRect &) const; | ||||
virtual void printTitle(QPainter *, const QRect &) const; | ||||
virtual void printScale(QPainter *, int axisId, int startDist, int endD | ||||
ist, | ||||
int baseDist, const QRect &) const; | ||||
virtual void printCanvas(QPainter *, | ||||
const QRect &boundingRect, const QRect &canvasRect, | ||||
const QwtScaleMap maps[axisCnt], const QwtPlotPrintFilter &) const; | ||||
virtual void printLegend(QPainter *, const QRect &) const; | ||||
private: | private: | |||
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; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 51 change blocks. | ||||
120 lines changed or deleted | 86 lines changed or added | |||
qwt_plot_canvas.h | qwt_plot_canvas.h | |||
---|---|---|---|---|
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | |||
* Qwt Widget Library | * Qwt Widget Library | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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 | |||
************************************************************************** ***/ | ************************************************************************** ***/ | |||
// vim: expandtab | ||||
#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 <qframe.h> | #include <qframe.h> | |||
#include <qpen.h> | #include <qpen.h> | |||
#include "qwt_global.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. | |||
\sa QwtPlot | \sa QwtPlot | |||
*/ | */ | |||
class QWT_EXPORT QwtPlotCanvas : public QFrame | class QWT_EXPORT QwtPlotCanvas : public QFrame | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
/*! | /*! | |||
\brief Paint attributes | \brief Paint attributes | |||
- PaintCached\n | The default setting enables BackingStore and Opaque. | |||
Paint double buffered and reuse the content of the pixmap buffer | ||||
for some spontaneous repaints that happen when a plot gets unhidden | ||||
, | ||||
deiconified or changes the focus. | ||||
Disabling the cache will improve the performance for | ||||
incremental paints (using QwtPlotCurve::draw). | ||||
- PaintPacked\n | ||||
Suppress system background repaints and paint it together with | ||||
the canvas contents. | ||||
Painting packed might avoid flickering for expensive repaints, | ||||
when there is a notable gap between painting the background | ||||
and the plot contents. | ||||
The default setting enables PaintCached and PaintPacked | \sa setPaintAttribute(), testPaintAttribute() | |||
\sa setPaintAttribute(), testPaintAttribute(), paintCache() | ||||
*/ | */ | |||
enum PaintAttribute | enum PaintAttribute | |||
{ | { | |||
PaintCached = 1, | /*! | |||
PaintPacked = 2 | \brief Paint double buffered reusing the content | |||
of the pixmap buffer when possible. | ||||
Using a backing store might improve the performance | ||||
significantly, when workin with widget overlays ( like rubberband | ||||
s ). | ||||
Disabling the cache might improve the performance for | ||||
incremental paints (using QwtPlotDirectPainter ). | ||||
\sa backingStore(), invalidateBackingStore() | ||||
*/ | ||||
BackingStore = 1, | ||||
/*! | ||||
\brief Try to fill the complete contents rectangle | ||||
of the plot canvas | ||||
When using styled backgrounds Qt assumes, that the | ||||
canvas doesn't fill its area completely | ||||
( f.e because of rounded borders ) and fills the area | ||||
below the canvas. When this is done with gradients it might | ||||
result in a serious performance bottleneck - depending on the siz | ||||
e. | ||||
When the Opaque attribute is enabled the canvas tries to | ||||
identify the gaps with some heuristics and to fill those only. | ||||
\warning Will not work for semitransparent backgrounds | ||||
*/ | ||||
Opaque = 2, | ||||
/*! | ||||
\brief Try to improve painting of styled backgrounds | ||||
QwtPlotCanvas supports the box model attributes for | ||||
customizing the layout with style sheets. Unfortunately | ||||
the design of Qt style sheets has no concept how to | ||||
handle backgrounds with rounded corners - beside of padding. | ||||
When HackStyledBackground is enabled the plot canvas tries | ||||
to seperate the background from the background border | ||||
by reverse engeneering to paint the background before and | ||||
the border after the plot items. In this order the border | ||||
gets prefectly antialiased and you can avoid some pixel | ||||
artifacts in the corners. | ||||
*/ | ||||
HackStyledBackground = 4, | ||||
/*! | ||||
When ImmediatePaint is set replot() calls repaint() | ||||
instead of update(). | ||||
\sa replot(), QWidget::repaint(), QWidget::update() | ||||
*/ | ||||
ImmediatePaint = 8 | ||||
}; | }; | |||
//! Paint attributes | ||||
typedef QFlags<PaintAttribute> PaintAttributes; | ||||
/*! | /*! | |||
\brief Focus indicator | \brief Focus indicator | |||
- NoFocusIndicator\n | - NoFocusIndicator\n | |||
Don't paint a focus indicator | Don't paint a focus indicator | |||
- CanvasFocusIndicator\n | - CanvasFocusIndicator\n | |||
The focus is related to the complete canvas. | The focus is related to the complete canvas. | |||
Paint the focus indicator using paintFocus() | Paint the focus indicator using paintFocus() | |||
skipping to change at line 84 | skipping to change at line 125 | |||
\sa setFocusIndicator(), focusIndicator(), paintFocus() | \sa setFocusIndicator(), focusIndicator(), paintFocus() | |||
*/ | */ | |||
enum FocusIndicator | enum FocusIndicator | |||
{ | { | |||
NoFocusIndicator, | NoFocusIndicator, | |||
CanvasFocusIndicator, | CanvasFocusIndicator, | |||
ItemFocusIndicator | ItemFocusIndicator | |||
}; | }; | |||
explicit QwtPlotCanvas(QwtPlot *); | explicit QwtPlotCanvas( QwtPlot * ); | |||
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 setPaintAttribute(PaintAttribute, bool on = true); | void setBorderRadius( double ); | |||
bool testPaintAttribute(PaintAttribute) const; | double borderRadius() const; | |||
QPixmap *paintCache(); | QPainterPath borderPath( const QRect &rect ) const; | |||
const QPixmap *paintCache() const; | QBitmap borderMask( const QSize & ) const; | |||
void invalidatePaintCache(); | ||||
void setPaintAttribute( PaintAttribute, bool on = true ); | ||||
bool testPaintAttribute( PaintAttribute ) const; | ||||
const QPixmap *backingStore() const; | ||||
void invalidateBackingStore(); | ||||
void replot(); | void replot(); | |||
protected: | virtual bool event( QEvent * ); | |||
virtual void hideEvent(QHideEvent *); | ||||
virtual void paintEvent(QPaintEvent *); | protected: | |||
virtual void paintEvent( QPaintEvent * ); | ||||
virtual void resizeEvent( QResizeEvent * ); | ||||
virtual void drawContents(QPainter *); | virtual void drawFocusIndicator( QPainter * ); | |||
virtual void drawFocusIndicator(QPainter *); | virtual void drawBorder( QPainter * ); | |||
void drawCanvas(QPainter *painter = NULL); | void updateStyleSheetInfo(); | |||
private: | private: | |||
void setSystemBackground(bool); | void drawCanvas( QPainter *, bool withBackground ); | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotCanvas::PaintAttributes ); | ||||
#endif | #endif | |||
End of changes. 17 change blocks. | ||||
36 lines changed or deleted | 86 lines changed or added | |||
qwt_plot_curve.h | qwt_plot_curve.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_CURVE_H | #ifndef QWT_PLOT_CURVE_H | |||
#define QWT_PLOT_CURVE_H | #define QWT_PLOT_CURVE_H | |||
#include <qpen.h> | ||||
#include <qstring.h> | ||||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include "qwt_plot_item.h" | #include "qwt_plot_seriesitem.h" | |||
#include "qwt_series_data.h" | ||||
#include "qwt_text.h" | #include "qwt_text.h" | |||
#include "qwt_polygon.h" | #include <qpen.h> | |||
#include "qwt_data.h" | #include <qstring.h> | |||
class QPainter; | class QPainter; | |||
class QPolygonF; | ||||
class QwtScaleMap; | class QwtScaleMap; | |||
class QwtSymbol; | class QwtSymbol; | |||
class QwtCurveFitter; | class QwtCurveFitter; | |||
/*! | /*! | |||
\brief A plot item, that represents a series of points | \brief A plot item, that represents a series of points | |||
A curve is the representation of a series of points in the x-y plane. | A curve is the representation of a series of points in the x-y plane. | |||
It supports different display styles, interpolation ( f.e. spline ) | It supports different display styles, interpolation ( f.e. spline ) | |||
and symbols. | and symbols. | |||
\par Usage | \par Usage | |||
<dl><dt>a) Assign curve properties</dt> | <dl><dt>a) Assign curve properties</dt> | |||
<dd>When a curve is created, it is configured to draw black solid lines | <dd>When a curve is created, it is configured to draw black solid lines | |||
with in Lines style and no symbols. You can change this by calling | with in QwtPlotCurve::Lines style and no symbols. | |||
You can change this by calling | ||||
setPen(), setStyle() and setSymbol().</dd> | setPen(), setStyle() and setSymbol().</dd> | |||
<dt>b) Connect/Assign data.</dt> | <dt>b) Connect/Assign data.</dt> | |||
<dd>QwtPlotCurve gets its points using a QwtData object offering | <dd>QwtPlotCurve gets its points using a QwtSeriesData object offering | |||
a bridge to the real storage of the points ( like QAbstractItemModel ). | a bridge to the real storage of the points ( like QAbstractItemModel ). | |||
There are several convenience classes derived from QwtData, that also sto re | There are several convenience classes derived from QwtSeriesData, that al so store | |||
the points inside ( like QStandardItemModel ). QwtPlotCurve also offers | the points inside ( like QStandardItemModel ). QwtPlotCurve also offers | |||
a couple of variations of setData(), that build QwtData objects from | a couple of variations of setSamples(), that build QwtSeriesData objects from | |||
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 QwtPlot, QwtData, QwtSymbol, QwtScaleMap | \sa QwtPointSeriesData, QwtSymbol, QwtScaleMap | |||
*/ | */ | |||
class QWT_EXPORT QwtPlotCurve: public QwtPlotItem | class QWT_EXPORT QwtPlotCurve: public QwtPlotSeriesItem<QPointF> | |||
{ | { | |||
public: | public: | |||
/*! | /*! | |||
Curve type. | ||||
- Yfx\n | ||||
Draws y as a function of x (the default). The | ||||
baseline is interpreted as a horizontal line | ||||
with y = baseline(). | ||||
- Xfy\n | ||||
Draws x as a function of y. The baseline is | ||||
interpreted as a vertical line with x = baseline(). | ||||
The baseline is used for aligning the sticks, or | ||||
filling the curve with a brush. | ||||
\sa setCurveType(), curveType(), baseline() brush() | ||||
*/ | ||||
enum CurveType | ||||
{ | ||||
Yfx, | ||||
Xfy | ||||
}; | ||||
/*! | ||||
Curve styles. | Curve styles. | |||
- NoCurve\n | ||||
Don't draw a curve. Note: This doesn't affect the symbols. | ||||
- Lines\n | ||||
Connect the points with straight lines. The lines might | ||||
be interpolated depending on the 'Fitted' attribute. Curve | ||||
fitting can be configured using setCurveFitter(). | ||||
- Sticks\n | ||||
Draw vertical(Yfx) or horizontal(Xfy) sticks from a baseline | ||||
which is defined by setBaseline(). | ||||
- Steps\n | ||||
Connect the points with a step function. The step function | ||||
is drawn from the left to the right or vice versa, | ||||
depending on the 'Inverted' attribute. | ||||
- Dots\n | ||||
Draw dots at the locations of the data points. Note: | ||||
This is different from a dotted line (see setPen()), and faster | ||||
as a curve in NoStyle style and a symbol painting a point. | ||||
- UserCurve\n | ||||
Styles >= UserCurve are reserved for derived | ||||
classes of QwtPlotCurve that overload drawCurve() with | ||||
additional application specific curve types. | ||||
\sa setStyle(), style() | \sa setStyle(), style() | |||
*/ | */ | |||
enum CurveStyle | enum CurveStyle | |||
{ | { | |||
NoCurve, | /*! | |||
Don't draw a curve. Note: This doesn't affect the symbols. | ||||
*/ | ||||
NoCurve = -1, | ||||
/*! | ||||
Connect the points with straight lines. The lines might | ||||
be interpolated depending on the 'Fitted' attribute. Curve | ||||
fitting can be configured using setCurveFitter(). | ||||
*/ | ||||
Lines, | Lines, | |||
/*! | ||||
Draw vertical or horizontal sticks ( depending on the | ||||
orientation() ) from a baseline which is defined by setBaseline( | ||||
). | ||||
*/ | ||||
Sticks, | Sticks, | |||
/*! | ||||
Connect the points with a step function. The step function | ||||
is drawn from the left to the right or vice versa, | ||||
depending on the QwtPlotCurve::Inverted attribute. | ||||
*/ | ||||
Steps, | Steps, | |||
/*! | ||||
Draw dots at the locations of the data points. Note: | ||||
This is different from a dotted line (see setPen()), and faster | ||||
as a curve in QwtPlotCurve::NoStyle style and a symbol | ||||
painting a point. | ||||
*/ | ||||
Dots, | Dots, | |||
/*! | ||||
Styles >= QwtPlotCurve::UserCurve are reserved for derived | ||||
classes of QwtPlotCurve that overload drawCurve() with | ||||
additional application specific curve types. | ||||
*/ | ||||
UserCurve = 100 | UserCurve = 100 | |||
}; | }; | |||
/*! | /*! | |||
Attribute for drawing the curve | Attribute for drawing the curve | |||
\sa setCurveAttribute(), testCurveAttribute(), curveFitter() | ||||
- Fitted ( in combination with the Lines QwtPlotCurve::CurveStyle onl | ||||
y )\n | ||||
A QwtCurveFitter tries to | ||||
interpolate/smooth the curve, before it is painted. | ||||
Note that curve fitting requires temorary memory | ||||
for calculating coefficients and additional points. | ||||
If painting in Fitted mode is slow it might be better | ||||
to fit the points, before they are passed to QwtPlotCurve. | ||||
- Inverted\n | ||||
For Steps only. Draws a step function | ||||
from the right to the left. | ||||
\sa setCurveAttribute(), testCurveAttribute(), curveFitter() | ||||
*/ | */ | |||
enum CurveAttribute | enum CurveAttribute | |||
{ | { | |||
Inverted = 1, | /*! | |||
Fitted = 2 | For QwtPlotCurve::Steps only. | |||
Draws a step function from the right to the left. | ||||
*/ | ||||
Inverted = 0x01, | ||||
/*! | ||||
Only in combination with QwtPlotCurve::Lines | ||||
A QwtCurveFitter tries to | ||||
interpolate/smooth the curve, before it is painted. | ||||
\note Curve fitting requires temorary memory | ||||
for calculating coefficients and additional points. | ||||
If painting in QwtPlotCurve::Fitted mode is slow it might be bett | ||||
er | ||||
to fit the points, before they are passed to QwtPlotCurve. | ||||
*/ | ||||
Fitted = 0x02 | ||||
}; | }; | |||
//! Curve attributes | ||||
typedef QFlags<CurveAttribute> CurveAttributes; | ||||
/*! | /*! | |||
Attributes to modify the drawing algorithm. | Attributes how to represent the curve on the legend | |||
- PaintFiltered\n | \sa setLegendAttribute(), testLegendAttribute(), | |||
Tries to reduce the data that has to be painted, by sorting out | drawLegendIdentifier() | |||
duplicates, or paintings outside the visible area. Might have a | */ | |||
notable impact on curves with many close points. | ||||
Only a couple of very basic filtering algos are implemented. | enum LegendAttribute | |||
- ClipPolygons\n | { | |||
Clip polygons before painting them. In situations, where points | /*! | |||
are far outside the visible area (f.e when zooming deep) this | QwtPlotCurve tries to find a color representing the curve | |||
might be a substantial improvement for the painting performance | and paints a rectangle with it. | |||
( especially on Windows ). | */ | |||
LegendNoAttribute = 0x00, | ||||
/*! | ||||
If the style() is not QwtPlotCurve::NoCurve a line | ||||
is painted with the curve pen(). | ||||
*/ | ||||
LegendShowLine = 0x01, | ||||
/*! | ||||
If the curve has a valid symbol it is painted. | ||||
*/ | ||||
LegendShowSymbol = 0x02, | ||||
/*! | ||||
If the curve has a brush a rectangle filled with the | ||||
curve brush() is painted. | ||||
*/ | ||||
LegendShowBrush = 0x04 | ||||
}; | ||||
The default is, that no paint attributes are enabled. | //! Legend attributes | |||
typedef QFlags<LegendAttribute> LegendAttributes; | ||||
/*! | ||||
Attributes to modify the drawing algorithm. | ||||
The default setting enables ClipPolygons | ||||
\sa setPaintAttribute(), testPaintAttribute() | \sa setPaintAttribute(), testPaintAttribute() | |||
*/ | */ | |||
enum PaintAttribute | enum PaintAttribute | |||
{ | { | |||
PaintFiltered = 1, | /*! | |||
ClipPolygons = 2 | Clip polygons before painting them. In situations, where points | |||
are far outside the visible area (f.e when zooming deep) this | ||||
might be a substantial improvement for the painting performance | ||||
*/ | ||||
ClipPolygons = 0x01, | ||||
/*! | ||||
Paint the symbol to a QPixmap and paint the pixmap | ||||
instead rendering the symbol for each point. The flag has | ||||
no effect, when the curve is not painted to the canvas | ||||
( f.e when exporting the plot to a PDF document ). | ||||
*/ | ||||
CacheSymbols = 0x02 | ||||
}; | }; | |||
explicit QwtPlotCurve(); | //! Paint attributes | |||
explicit QwtPlotCurve(const QwtText &title); | typedef QFlags<PaintAttribute> PaintAttributes; | |||
explicit QwtPlotCurve(const QString &title); | ||||
explicit QwtPlotCurve( const QString &title = QString::null ); | ||||
explicit QwtPlotCurve( const QwtText &title ); | ||||
virtual ~QwtPlotCurve(); | virtual ~QwtPlotCurve(); | |||
virtual int rtti() const; | virtual int rtti() const; | |||
void setCurveType(CurveType); | void setPaintAttribute( PaintAttribute, bool on = true ); | |||
CurveType curveType() const; | bool testPaintAttribute( PaintAttribute ) const; | |||
void setPaintAttribute(PaintAttribute, bool on = true); | void setLegendAttribute( LegendAttribute, bool on = true ); | |||
bool testPaintAttribute(PaintAttribute) const; | bool testLegendAttribute( LegendAttribute ) const; | |||
void setRawData(const double *x, const double *y, int size); | #ifndef QWT_NO_COMPAT | |||
void setData(const double *xData, const double *yData, int size); | void setRawSamples( const double *xData, const double *yData, int size | |||
void setData(const QwtArray<double> &xData, const QwtArray<double> &yDa | ); | |||
ta); | void setSamples( const double *xData, const double *yData, int size ); | |||
#if QT_VERSION < 0x040000 | void setSamples( const QVector<double> &xData, const QVector<double> &y | |||
void setData(const QwtArray<QwtDoublePoint> &data); | Data ); | |||
#else | ||||
void setData(const QPolygonF &data); | ||||
#endif | #endif | |||
void setData(const QwtData &data); | void setSamples( const QVector<QPointF> & ); | |||
int closestPoint(const QPoint &pos, double *dist = NULL) const; | ||||
QwtData &data(); | ||||
const QwtData &data() const; | ||||
int dataSize() const; | int closestPoint( const QPoint &pos, double *dist = NULL ) const; | |||
double x(int i) const; | ||||
double y(int i) const; | ||||
virtual QwtDoubleRect boundingRect() 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 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 ref ); | |||
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( const QwtSymbol *s ); | |||
const QwtSymbol& symbol() const; | const QwtSymbol *symbol() const; | |||
void setCurveFitter(QwtCurveFitter *); | void setCurveFitter( QwtCurveFitter * ); | |||
QwtCurveFitter *curveFitter() const; | QwtCurveFitter *curveFitter() const; | |||
virtual void draw(QPainter *p, | virtual void drawSeries( QPainter *, | |||
const QwtScaleMap &xMap, const QwtScaleMap &yMap, | ||||
const QRect &) const; | ||||
virtual void draw(QPainter *p, | ||||
const QwtScaleMap &xMap, const QwtScaleMap &yMap, | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |||
int from, int to) const; | const QRectF &canvasRect, int from, int to ) const; | |||
void draw(int from, int to) const; | virtual void updateLegend( QwtLegend * ) const; | |||
virtual void drawLegendIdentifier( QPainter *, const QRectF & ) const; | ||||
virtual void updateLegend(QwtLegend *) const; | ||||
protected: | protected: | |||
void init(); | void init(); | |||
virtual void drawCurve(QPainter *p, int style, | virtual void drawCurve( QPainter *p, int style, | |||
const QwtScaleMap &xMap, const QwtScaleMap &yMap, | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |||
int from, int to) const; | const QRectF &canvasRect, int from, int to ) const; | |||
virtual void drawSymbols(QPainter *p, const QwtSymbol &, | virtual void drawSymbols( QPainter *p, const QwtSymbol &, | |||
const QwtScaleMap &xMap, const QwtScaleMap &yMap, | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |||
int from, int to) const; | const QRectF &canvasRect, int from, int to ) const; | |||
void drawLines(QPainter *p, | void drawLines( QPainter *p, | |||
const QwtScaleMap &xMap, const QwtScaleMap &yMap, | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |||
int from, int to) const; | const QRectF &canvasRect, int from, int to ) const; | |||
void drawSticks(QPainter *p, | ||||
void drawSticks( QPainter *p, | ||||
const QwtScaleMap &xMap, const QwtScaleMap &yMap, | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |||
int from, int to) const; | const QRectF &canvasRect, int from, int to ) const; | |||
void drawDots(QPainter *p, | ||||
void drawDots( QPainter *p, | ||||
const QwtScaleMap &xMap, const QwtScaleMap &yMap, | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |||
int from, int to) const; | const QRectF &canvasRect, int from, int to ) const; | |||
void drawSteps(QPainter *p, | ||||
void drawSteps( QPainter *p, | ||||
const QwtScaleMap &xMap, const QwtScaleMap &yMap, | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |||
int from, int to) const; | const QRectF &canvasRect, int from, int to ) const; | |||
void fillCurve(QPainter *, | virtual void fillCurve( QPainter *, | |||
const QwtScaleMap &, const QwtScaleMap &, | const QwtScaleMap &, const QwtScaleMap &, | |||
QwtPolygon &) const; | const QRectF &canvasRect, QPolygonF & ) const; | |||
void closePolyline(const QwtScaleMap &, const QwtScaleMap &, | ||||
QwtPolygon &) const; | ||||
private: | void closePolyline( QPainter *, | |||
QwtData *d_xy; | const QwtScaleMap &, const QwtScaleMap &, QPolygonF & ) const; | |||
private: | ||||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
//! \return the the curve data | ||||
inline QwtData &QwtPlotCurve::data() | ||||
{ | ||||
return *d_xy; | ||||
} | ||||
//! \return the the curve data | ||||
inline const QwtData &QwtPlotCurve::data() const | ||||
{ | ||||
return *d_xy; | ||||
} | ||||
/*! | ||||
\param i index | ||||
\return x-value at position i | ||||
*/ | ||||
inline double QwtPlotCurve::x(int i) const | ||||
{ | ||||
return d_xy->x(i); | ||||
} | ||||
/*! | ||||
\param i index | ||||
\return y-value at position i | ||||
*/ | ||||
inline double QwtPlotCurve::y(int i) const | ||||
{ | ||||
return d_xy->y(i); | ||||
} | ||||
//! boundingRect().left() | //! boundingRect().left() | |||
inline double QwtPlotCurve::minXValue() const | inline double QwtPlotCurve::minXValue() const | |||
{ | { | |||
return boundingRect().left(); | return boundingRect().left(); | |||
} | } | |||
//! boundingRect().right() | //! boundingRect().right() | |||
inline double QwtPlotCurve::maxXValue() const | inline double QwtPlotCurve::maxXValue() const | |||
{ | { | |||
return boundingRect().right(); | return boundingRect().right(); | |||
skipping to change at line 329 | skipping to change at line 315 | |||
{ | { | |||
return boundingRect().top(); | return boundingRect().top(); | |||
} | } | |||
//! boundingRect().bottom() | //! boundingRect().bottom() | |||
inline double QwtPlotCurve::maxYValue() const | inline double QwtPlotCurve::maxYValue() const | |||
{ | { | |||
return boundingRect().bottom(); | return boundingRect().bottom(); | |||
} | } | |||
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotCurve::PaintAttributes ); | ||||
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotCurve::LegendAttributes ); | ||||
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotCurve::CurveAttributes ); | ||||
#endif | #endif | |||
End of changes. 56 change blocks. | ||||
179 lines changed or deleted | 171 lines changed or added | |||
qwt_plot_dict.h | qwt_plot_dict.h | |||
---|---|---|---|---|
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | |||
* Qwt Widget Library | * Qwt Widget Library | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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 | |||
************************************************************************** ***/ | ************************************************************************** ***/ | |||
// vim: expandtab | ||||
/*! \file !*/ | /*! \file !*/ | |||
#ifndef QWT_PLOT_DICT | #ifndef QWT_PLOT_DICT | |||
#define QWT_PLOT_DICT | #define QWT_PLOT_DICT | |||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include "qwt_plot_item.h" | #include "qwt_plot_item.h" | |||
#if QT_VERSION < 0x040000 | ||||
#include <qvaluelist.h> | ||||
typedef QValueListConstIterator<QwtPlotItem *> QwtPlotItemIterator; | ||||
/// \var typedef QValueList< QwtPlotItem *> QwtPlotItemList | ||||
/// \brief See QT 3.x assistant documentation for QValueList | ||||
typedef QValueList<QwtPlotItem *> QwtPlotItemList; | ||||
#else | ||||
#include <qlist.h> | #include <qlist.h> | |||
typedef QList<QwtPlotItem *>::ConstIterator QwtPlotItemIterator; | ||||
/// \var typedef QList< QwtPlotItem *> QwtPlotItemList | /// \var typedef QList< QwtPlotItem *> QwtPlotItemList | |||
/// \brief See QT 4.x assistant documentation for QList | /// \brief See QT 4.x assistant documentation for QList | |||
typedef QList<QwtPlotItem *> QwtPlotItemList; | typedef QList<QwtPlotItem *> QwtPlotItemList; | |||
#endif | typedef QList<QwtPlotItem *>::ConstIterator QwtPlotItemIterator; | |||
/*! | /*! | |||
\brief A dictionary for plot items | \brief A dictionary for plot items | |||
QwtPlotDict organizes plot items in increasing z-order. | QwtPlotDict organizes plot items in increasing z-order. | |||
If autoDelete() is enabled, all attached items will be deleted | If autoDelete() is enabled, all attached items will be deleted | |||
in the destructor of the dictionary. | in the destructor of the dictionary. | |||
\sa QwtPlotItem::attach(), QwtPlotItem::detach(), QwtPlotItem::z() | \sa QwtPlotItem::attach(), QwtPlotItem::detach(), QwtPlotItem::z() | |||
*/ | */ | |||
class QWT_EXPORT QwtPlotDict | class QWT_EXPORT QwtPlotDict | |||
{ | { | |||
public: | public: | |||
explicit QwtPlotDict(); | explicit QwtPlotDict(); | |||
~QwtPlotDict(); | virtual ~QwtPlotDict(); | |||
void setAutoDelete(bool); | void setAutoDelete( bool ); | |||
bool autoDelete() const; | bool autoDelete() const; | |||
const QwtPlotItemList& itemList() const; | const QwtPlotItemList& itemList() const; | |||
QwtPlotItemList itemList( int rtti ) const; | ||||
void detachItems(int rtti = QwtPlotItem::Rtti_PlotItem, | void detachItems( int rtti = QwtPlotItem::Rtti_PlotItem, | |||
bool autoDelete = true); | bool autoDelete = true ); | |||
private: | private: | |||
friend class QwtPlotItem; | friend class QwtPlotItem; | |||
void attachItem(QwtPlotItem *, bool); | void attachItem( QwtPlotItem *, bool ); | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 9 change blocks. | ||||
17 lines changed or deleted | 8 lines changed or added | |||
qwt_plot_grid.h | qwt_plot_grid.h | |||
---|---|---|---|---|
skipping to change at line 42 | skipping to change at line 42 | |||
*/ | */ | |||
class QWT_EXPORT QwtPlotGrid: public QwtPlotItem | class QWT_EXPORT QwtPlotGrid: public QwtPlotItem | |||
{ | { | |||
public: | public: | |||
explicit QwtPlotGrid(); | explicit QwtPlotGrid(); | |||
virtual ~QwtPlotGrid(); | virtual ~QwtPlotGrid(); | |||
virtual int rtti() const; | virtual int rtti() const; | |||
void enableX(bool tf); | void enableX( bool tf ); | |||
bool xEnabled() const; | bool xEnabled() const; | |||
void enableY(bool tf); | void enableY( bool tf ); | |||
bool yEnabled() const; | bool yEnabled() const; | |||
void enableXMin(bool tf); | void enableXMin( bool tf ); | |||
bool xMinEnabled() const; | bool xMinEnabled() const; | |||
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 QPen &p ); | |||
void setMajPen(const QPen &p); | void setMajPen( const QPen &p ); | |||
const QPen& majPen() const; | const QPen& majPen() const; | |||
void setMinPen(const QPen &p); | void setMinPen( const QPen &p ); | |||
const QPen& minPen() const; | const QPen& minPen() const; | |||
virtual void draw(QPainter *p, | virtual void draw( QPainter *p, | |||
const QwtScaleMap &xMap, const QwtScaleMap &yMap, | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |||
const QRect &rect) const; | const QRectF &rect ) const; | |||
virtual void updateScaleDiv(const QwtScaleDiv &xMap, | virtual void updateScaleDiv( | |||
const QwtScaleDiv &yMap); | const QwtScaleDiv &xMap, const QwtScaleDiv &yMap ); | |||
private: | private: | |||
void drawLines(QPainter *painter, const QRect &, | void drawLines( QPainter *painter, const QRectF &, | |||
Qt::Orientation orientation, const QwtScaleMap &, | Qt::Orientation orientation, const QwtScaleMap &, | |||
const QwtValueList &) const; | const QList<double> & ) const; | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 14 change blocks. | ||||
15 lines changed or deleted | 15 lines changed or added | |||
qwt_plot_item.h | qwt_plot_item.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_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_legend_itemmanager.h" | |||
#include "qwt_text.h" | #include "qwt_text.h" | |||
#include "qwt_double_rect.h" | #include <qrect.h> | |||
class QString; | class QString; | |||
class QRect; | ||||
class QPainter; | class QPainter; | |||
class QWidget; | class QWidget; | |||
class QwtPlot; | class QwtPlot; | |||
class QwtLegend; | class QwtLegend; | |||
class QwtScaleMap; | class QwtScaleMap; | |||
class QwtScaleDiv; | class QwtScaleDiv; | |||
/*! | /*! | |||
\brief Base class for items on the plot canvas | \brief Base class for items on the plot canvas | |||
skipping to change at line 82 | skipping to change at line 81 | |||
having to enable runtime type information of the compiler. | having to enable runtime type information of the compiler. | |||
*/ | */ | |||
enum RttiValues | enum RttiValues | |||
{ | { | |||
Rtti_PlotItem = 0, | Rtti_PlotItem = 0, | |||
Rtti_PlotGrid, | Rtti_PlotGrid, | |||
Rtti_PlotScale, | Rtti_PlotScale, | |||
Rtti_PlotMarker, | Rtti_PlotMarker, | |||
Rtti_PlotCurve, | Rtti_PlotCurve, | |||
Rtti_PlotSpectroCurve, | ||||
Rtti_PlotIntervalCurve, | ||||
Rtti_PlotHistogram, | Rtti_PlotHistogram, | |||
Rtti_PlotSpectrogram, | Rtti_PlotSpectrogram, | |||
Rtti_PlotSVG, | Rtti_PlotSVG, | |||
Rtti_PlotUserItem = 1000 | Rtti_PlotUserItem = 1000 | |||
}; | }; | |||
/*! | /*! | |||
Plot Item Attributes | Plot Item Attributes | |||
- Legend\n | ||||
The item is represented on the legend. | ||||
- AutoScale \n | ||||
The boundingRect() of the item is included in the | ||||
autoscaling calculation. | ||||
\sa setItemAttribute(), testItemAttribute() | \sa setItemAttribute(), testItemAttribute() | |||
*/ | */ | |||
enum ItemAttribute | enum ItemAttribute | |||
{ | { | |||
Legend = 1, | //! The item is represented on the legend. | |||
AutoScale = 2 | Legend = 0x01, | |||
/*! | ||||
The boundingRect() of the item is included in the | ||||
autoscaling calculation. | ||||
*/ | ||||
AutoScale = 0x02 | ||||
}; | }; | |||
#if QT_VERSION >= 0x040000 | //! Plot Item Attributes | |||
typedef QFlags<ItemAttribute> ItemAttributes; | ||||
//! Render hints | //! Render hints | |||
enum RenderHint | enum RenderHint | |||
{ | { | |||
//! Enable antialiasing | ||||
RenderAntialiased = 1 | RenderAntialiased = 1 | |||
}; | }; | |||
#endif | ||||
explicit QwtPlotItem(const QwtText &title = QwtText()); | //! Render hints | |||
typedef QFlags<RenderHint> RenderHints; | ||||
explicit QwtPlotItem( const QwtText &title = QwtText() ); | ||||
virtual ~QwtPlotItem(); | virtual ~QwtPlotItem(); | |||
void attach(QwtPlot *plot); | void attach( QwtPlot *plot ); | |||
void detach(); | ||||
/*! | ||||
\brief This method detaches a QwtPlotItem from any QwtPlot it has be | ||||
en | ||||
associated with. | ||||
detach() is equivalent to calling attach( NULL ) | ||||
\sa attach( QwtPlot* plot ) | ||||
*/ | ||||
void detach() { attach(NULL); } | ||||
QwtPlot *plot() const; | QwtPlot *plot() const; | |||
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; | |||
#if QT_VERSION >= 0x040000 | void setRenderHint( RenderHint, bool on = true ); | |||
void setRenderHint(RenderHint, bool on = true); | bool testRenderHint( RenderHint ) const; | |||
bool testRenderHint(RenderHint) const; | ||||
#endif | ||||
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 setAxis(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(); | |||
/*! | /*! | |||
\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 QRect &canvasRect) const = 0; | const QRectF &canvasRect ) const = 0; | |||
virtual QwtDoubleRect boundingRect() const; | virtual QRectF boundingRect() const; | |||
virtual void updateLegend(QwtLegend *) const; | virtual void updateLegend( QwtLegend * ) const; | |||
virtual void updateScaleDiv(const QwtScaleDiv&, | virtual void updateScaleDiv( | |||
const QwtScaleDiv&); | const QwtScaleDiv&, const QwtScaleDiv& ); | |||
virtual QWidget *legendItem() const; | virtual QWidget *legendItem() const; | |||
QwtDoubleRect scaleRect(const QwtScaleMap &, const QwtScaleMap &) const | QRectF scaleRect( const QwtScaleMap &, const QwtScaleMap & ) const; | |||
; | QRectF paintRect( const QwtScaleMap &, const QwtScaleMap & ) const; | |||
QRect paintRect(const QwtScaleMap &, const QwtScaleMap &) const; | ||||
QRect transform(const QwtScaleMap &, const QwtScaleMap &, | ||||
const QwtDoubleRect&) const; | ||||
QwtDoubleRect invTransform(const QwtScaleMap &, const QwtScaleMap &, | ||||
const QRect&) 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::RenderHints ); | ||||
#endif | #endif | |||
End of changes. 24 change blocks. | ||||
52 lines changed or deleted | 43 lines changed or added | |||
qwt_plot_layout.h | qwt_plot_layout.h | |||
---|---|---|---|---|
skipping to change at line 29 | skipping to change at line 29 | |||
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. | |||
*/ | */ | |||
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 | ||||
- AlignScales\n | ||||
Unused | ||||
- IgnoreScrollbars\n | ||||
Ignore the dimension of the scrollbars. There are no | ||||
scrollbars, when the plot is rendered to a paint device | ||||
(QwtPlot::print() ). | ||||
- IgnoreFrames\n | ||||
Ignore all frames. QwtPlot::print() doesn't paint them. | ||||
- IgnoreMargin\n | ||||
Ignore the margin(). | ||||
- IgnoreLegend\n | ||||
Ignore the legend. | ||||
\sa activate() | ||||
*/ | */ | |||
enum Options | enum Option | |||
{ | { | |||
AlignScales = 1, | //! Unused | |||
IgnoreScrollbars = 2, | AlignScales = 0x01, | |||
IgnoreFrames = 4, | ||||
IgnoreMargin = 8, | /*! | |||
IgnoreLegend = 16 | Ignore the dimension of the scrollbars. There are no | |||
scrollbars, when the plot is not rendered to widgets. | ||||
*/ | ||||
IgnoreScrollbars = 0x02, | ||||
//! Ignore all frames. | ||||
IgnoreFrames = 0x04, | ||||
//! Ignore the legend. | ||||
IgnoreLegend = 0x08 | ||||
}; | }; | |||
//! Layout options | ||||
typedef QFlags<Option> Options; | ||||
explicit QwtPlotLayout(); | explicit QwtPlotLayout(); | |||
virtual ~QwtPlotLayout(); | virtual ~QwtPlotLayout(); | |||
void setMargin(int); | void setCanvasMargin( int margin, int axis = -1 ); | |||
int margin() const; | int canvasMargin( int axis ) const; | |||
void setCanvasMargin(int margin, int axis = -1); | void setAlignCanvasToScales( bool ); | |||
int canvasMargin(int axis) const; | ||||
void setAlignCanvasToScales(bool); | ||||
bool alignCanvasToScales() const; | bool alignCanvasToScales() 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 QRect &rect, int options = 0); | const QRectF &rect, Options options = 0x00 ); | |||
virtual void invalidate(); | virtual void invalidate(); | |||
const QRect &titleRect() const; | const QRectF &titleRect() const; | |||
const QRect &legendRect() const; | const QRectF &legendRect() const; | |||
const QRect &scaleRect(int axis) const; | const QRectF &scaleRect( int axis ) const; | |||
const QRect &canvasRect() const; | const QRectF &canvasRect() const; | |||
class LayoutData; | class LayoutData; | |||
protected: | protected: | |||
QRect layoutLegend(int options, const QRect &) const; | QRectF layoutLegend( Options options, const QRectF & ) const; | |||
QRect alignLegend(const QRect &canvasRect, | QRectF alignLegend( const QRectF &canvasRect, | |||
const QRect &legendRect) const; | const QRectF &legendRect ) const; | |||
void expandLineBreaks(int options, const QRect &rect, | void expandLineBreaks( int options, const QRectF &rect, | |||
int &dimTitle, int dimAxes[QwtPlot::axisCnt]) const; | int &dimTitle, int dimAxes[QwtPlot::axisCnt] ) const; | |||
void alignScales(int options, QRect &canvasRect, | void alignScales( int options, QRectF &canvasRect, | |||
QRect 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 ); | ||||
#endif | #endif | |||
End of changes. 16 change blocks. | ||||
45 lines changed or deleted | 42 lines changed or added | |||
qwt_plot_magnifier.h | qwt_plot_magnifier.h | |||
---|---|---|---|---|
skipping to change at line 35 | skipping to change at line 35 | |||
Together with QwtPlotZoomer and QwtPlotPanner it is possible to implement | Together with QwtPlotZoomer and QwtPlotPanner it is possible to implement | |||
individual and powerful navigation of the plot canvas. | individual and powerful navigation of the plot canvas. | |||
\sa QwtPlotZoomer, QwtPlotPanner, QwtPlot | \sa QwtPlotZoomer, QwtPlotPanner, QwtPlot | |||
*/ | */ | |||
class QWT_EXPORT QwtPlotMagnifier: public QwtMagnifier | class QWT_EXPORT QwtPlotMagnifier: public QwtMagnifier | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
explicit QwtPlotMagnifier(QwtPlotCanvas *); | explicit QwtPlotMagnifier( QwtPlotCanvas * ); | |||
virtual ~QwtPlotMagnifier(); | virtual ~QwtPlotMagnifier(); | |||
void setAxisEnabled(int axis, bool on); | void setAxisEnabled( int axis, bool on ); | |||
bool isAxisEnabled(int axis) const; | bool isAxisEnabled( int axis ) const; | |||
QwtPlotCanvas *canvas(); | QwtPlotCanvas *canvas(); | |||
const QwtPlotCanvas *canvas() const; | const QwtPlotCanvas *canvas() const; | |||
QwtPlot *plot(); | QwtPlot *plot(); | |||
const QwtPlot *plot() const; | const QwtPlot *plot() const; | |||
protected: | protected: | |||
virtual void rescale(double factor); | virtual void rescale( double factor ); | |||
private: | private: | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
qwt_plot_marker.h | qwt_plot_marker.h | |||
---|---|---|---|---|
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | |||
* Qwt Widget Library | * Qwt Widget Library | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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 | |||
************************************************************************** ***/ | ************************************************************************** ***/ | |||
// vim: expandtab | ||||
#ifndef QWT_PLOT_MARKER_H | #ifndef QWT_PLOT_MARKER_H | |||
#define QWT_PLOT_MARKER_H | #define QWT_PLOT_MARKER_H | |||
#include <qpen.h> | #include <qpen.h> | |||
#include <qfont.h> | #include <qfont.h> | |||
#include <qstring.h> | #include <qstring.h> | |||
#include <qbrush.h> | #include <qbrush.h> | |||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include "qwt_plot_item.h" | #include "qwt_plot_item.h" | |||
class QRect; | class QRectF; | |||
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 QwtPlotMarker::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 QwtPlotMarker::setLabel(), a label can be assigned to the marker. | With setLabel(), a label can be assigned to the marker. | |||
The QwtPlotMarker::setLabelAlignment() member specifies where the label i | The setLabelAlignment() member specifies where the label is | |||
s | ||||
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 AlignLeft|AlignTo | left above the center point if the alignment was set to | |||
p. | Qt::AlignLeft | Qt::AlignTop. | |||
*/ | */ | |||
class QWT_EXPORT QwtPlotMarker: public QwtPlotItem | class QWT_EXPORT QwtPlotMarker: public QwtPlotItem | |||
{ | { | |||
public: | public: | |||
/*! | /*! | |||
Line styles. | Line styles. | |||
\sa setLineStyle(), lineStyle() | \sa setLineStyle(), lineStyle() | |||
*/ | */ | |||
enum LineStyle | enum LineStyle | |||
{ | { | |||
//! No line | ||||
NoLine, | NoLine, | |||
//! A horizontal line | ||||
HLine, | HLine, | |||
//! A vertical line | ||||
VLine, | VLine, | |||
//! A crosshair | ||||
Cross | Cross | |||
}; | }; | |||
explicit QwtPlotMarker(); | explicit QwtPlotMarker(); | |||
virtual ~QwtPlotMarker(); | virtual ~QwtPlotMarker(); | |||
virtual int rtti() const; | virtual int rtti() const; | |||
double xValue() const; | double xValue() const; | |||
double yValue() const; | double yValue() const; | |||
QwtDoublePoint 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 QwtDoublePoint &); | void setValue( const QPointF & ); | |||
void setLineStyle(LineStyle st); | void setLineStyle( LineStyle st ); | |||
LineStyle lineStyle() const; | LineStyle lineStyle() const; | |||
void setLinePen(const QPen &p); | void setLinePen( const QPen &p ); | |||
const QPen &linePen() const; | const QPen &linePen() const; | |||
void setSymbol(const QwtSymbol &s); | 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; | |||
#if QT_VERSION < 0x040000 | void setLabelAlignment( Qt::Alignment ); | |||
void setLabelAlignment(int align); | ||||
int labelAlignment() const; | ||||
#else | ||||
void setLabelAlignment(Qt::Alignment); | ||||
Qt::Alignment labelAlignment() const; | Qt::Alignment labelAlignment() const; | |||
#endif | ||||
void setLabelOrientation(Qt::Orientation); | void setLabelOrientation( Qt::Orientation ); | |||
Qt::Orientation labelOrientation() const; | Qt::Orientation labelOrientation() const; | |||
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 QRect &) const; | const QRectF & ) const; | |||
virtual QRectF boundingRect() const; | ||||
virtual QwtDoubleRect boundingRect() const; | virtual void updateLegend( QwtLegend * ) const; | |||
virtual void drawLegendIdentifier( QPainter *, const QRectF & ) const; | ||||
protected: | protected: | |||
void drawAt(QPainter *,const QRect &, const QPoint &) const; | virtual void drawLines( QPainter *, | |||
const QRectF &, const QPointF & ) const; | ||||
virtual void drawLabel( QPainter *, | ||||
const QRectF &, const QPointF & ) const; | ||||
private: | private: | |||
void drawLabel(QPainter *, const QRect &, const QPoint &) const; | ||||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 23 change blocks. | ||||
31 lines changed or deleted | 36 lines changed or added | |||
qwt_plot_panner.h | qwt_plot_panner.h | |||
---|---|---|---|---|
skipping to change at line 37 | skipping to change at line 37 | |||
of navigating on a QwtPlot widget can be implemented easily. | of navigating on a QwtPlot widget can be implemented easily. | |||
\note The axes are not updated, while dragging the canvas | \note The axes are not updated, while dragging the canvas | |||
\sa QwtPlotZoomer, QwtPlotMagnifier | \sa QwtPlotZoomer, QwtPlotMagnifier | |||
*/ | */ | |||
class QWT_EXPORT QwtPlotPanner: public QwtPanner | class QWT_EXPORT QwtPlotPanner: public QwtPanner | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
explicit QwtPlotPanner(QwtPlotCanvas *); | explicit QwtPlotPanner( QwtPlotCanvas * ); | |||
virtual ~QwtPlotPanner(); | virtual ~QwtPlotPanner(); | |||
QwtPlotCanvas *canvas(); | QwtPlotCanvas *canvas(); | |||
const QwtPlotCanvas *canvas() const; | const QwtPlotCanvas *canvas() const; | |||
QwtPlot *plot(); | QwtPlot *plot(); | |||
const QwtPlot *plot() const; | const QwtPlot *plot() const; | |||
void setAxisEnabled(int axis, bool on); | void setAxisEnabled( int axis, bool on ); | |||
bool isAxisEnabled(int axis) const; | bool isAxisEnabled( int axis ) const; | |||
protected slots: | protected Q_SLOTS: | |||
virtual void moveCanvas(int dx, int dy); | virtual void moveCanvas( int dx, int dy ); | |||
protected: | ||||
virtual QBitmap contentsMask() const; | ||||
private: | private: | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 8 lines changed or added | |||
qwt_plot_picker.h | qwt_plot_picker.h | |||
---|---|---|---|---|
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | |||
* Qwt Widget Library | * Qwt Widget Library | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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 | |||
************************************************************************** ***/ | ************************************************************************** ***/ | |||
// vim: expandtab | ||||
#ifndef QWT_PLOT_PICKER_H | #ifndef QWT_PLOT_PICKER_H | |||
#define QWT_PLOT_PICKER_H | #define QWT_PLOT_PICKER_H | |||
#include "qwt_double_rect.h" | #include "qwt_global.h" | |||
#include "qwt_plot_canvas.h" | #include "qwt_plot_canvas.h" | |||
#include "qwt_picker.h" | #include "qwt_picker.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 coodinate system. | |||
*/ | */ | |||
class QWT_EXPORT QwtPlotPicker: public QwtPicker | class QWT_EXPORT QwtPlotPicker: public QwtPicker | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
explicit QwtPlotPicker(QwtPlotCanvas *); | explicit QwtPlotPicker( QwtPlotCanvas * ); | |||
virtual ~QwtPlotPicker(); | virtual ~QwtPlotPicker(); | |||
explicit QwtPlotPicker(int xAxis, int yAxis, | explicit QwtPlotPicker( int xAxis, int yAxis, QwtPlotCanvas * ); | |||
QwtPlotCanvas *); | ||||
explicit QwtPlotPicker(int xAxis, int yAxis, int selectionFlags, | explicit QwtPlotPicker( int xAxis, int yAxis, | |||
RubberBand rubberBand, DisplayMode trackerMode, | RubberBand rubberBand, DisplayMode trackerMode, | |||
QwtPlotCanvas *); | 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(); | QwtPlotCanvas *canvas(); | |||
const QwtPlotCanvas *canvas() const; | const QwtPlotCanvas *canvas() const; | |||
signals: | Q_SIGNALS: | |||
/*! | /*! | |||
A signal emitted in case of selectionFlags() & PointSelection. | A signal emitted in case of selectionFlags() & PointSelection. | |||
\param pos Selected point | \param pos Selected point | |||
*/ | */ | |||
void selected(const QwtDoublePoint &pos); | void selected( const QPointF &pos ); | |||
/*! | /*! | |||
A signal emitted in case of selectionFlags() & RectSelection. | A signal emitted in case of selectionFlags() & RectSelection. | |||
\param rect Selected rectangle | \param rect Selected rectangle | |||
*/ | */ | |||
void selected(const QwtDoubleRect &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 | |||
*/ | */ | |||
void selected(const QwtArray<QwtDoublePoint> &pa); | void selected( const QVector<QPointF> &pa ); | |||
/*! | /*! | |||
A signal emitted when a point has been appended to the selection | A signal emitted when a point has been appended to the selection | |||
\param pos Position of the appended point. | \param pos Position of the appended point. | |||
\sa append(). moved() | \sa append(). moved() | |||
*/ | */ | |||
void appended(const QwtDoublePoint &pos); | void appended( const QPointF &pos ); | |||
/*! | /*! | |||
A signal emitted whenever the last appended point of the | A signal emitted whenever the last appended point of the | |||
selection has been moved. | selection has been moved. | |||
\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 QwtDoublePoint &pos); | void moved( const QPointF &pos ); | |||
protected: | protected: | |||
QwtDoubleRect scaleRect() const; | QRectF scaleRect() const; | |||
QwtDoubleRect invTransform(const QRect &) const; | QRectF invTransform( const QRect & ) const; | |||
QRect transform(const QwtDoubleRect &) const; | QRect transform( const QRectF & ) const; | |||
QwtDoublePoint invTransform(const QPoint &) const; | QPointF invTransform( const QPoint & ) const; | |||
QPoint transform(const QwtDoublePoint &) const; | QPoint transform( const QPointF & ) const; | |||
virtual QwtText trackerText(const QPoint &) const; | virtual QwtText trackerText( const QPoint & ) const; | |||
virtual QwtText trackerText(const QwtDoublePoint &) const; | virtual QwtText trackerTextF( const QPointF & ) const; | |||
virtual void move(const QPoint &); | virtual void move( const QPoint & ); | |||
virtual void append(const QPoint &); | virtual void append( const QPoint & ); | |||
virtual bool end(bool ok = true); | virtual bool end( bool ok = true ); | |||
private: | private: | |||
int d_xAxis; | int d_xAxis; | |||
int d_yAxis; | int d_yAxis; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 19 change blocks. | ||||
25 lines changed or deleted | 23 lines changed or added | |||
qwt_plot_rasteritem.h | qwt_plot_rasteritem.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_RASTERITEM_H | #ifndef QWT_PLOT_RASTERITEM_H | |||
#define QWT_PLOT_RASTERITEM_H | #define QWT_PLOT_RASTERITEM_H | |||
#include "qwt_global.h" | ||||
#include "qwt_plot_item.h" | ||||
#include "qwt_interval.h" | ||||
#include <qglobal.h> | #include <qglobal.h> | |||
#include <qstring.h> | #include <qstring.h> | |||
#include <qimage.h> | #include <qimage.h> | |||
#include "qwt_plot_item.h" | ||||
/*! | /*! | |||
\brief A class, which displays raster data | \brief A class, which displays raster data | |||
Raster data is a grid of pixel values, that can be represented | Raster data is a grid of pixel values, that can be represented | |||
as a QImage. It is used for many types of information like | as a QImage. It is used for many types of information like | |||
spectrograms, cartograms, geographical maps ... | spectrograms, cartograms, geographical maps ... | |||
Often a plot has several types of raster data organized in layers. | Often a plot has several types of raster data organized in layers. | |||
( f.e a geographical map, with weather statistics ). | ( f.e a geographical map, with weather statistics ). | |||
Using setAlpha() raster items can be stacked easily. | Using setAlpha() raster items can be stacked easily. | |||
skipping to change at line 48 | skipping to change at line 49 | |||
public: | public: | |||
/*! | /*! | |||
- NoCache\n | - NoCache\n | |||
renderImage() is called, whenever the item has to be repainted | renderImage() is called, whenever the item has to be repainted | |||
- PaintCache\n | - PaintCache\n | |||
renderImage() is called, whenever the image cache is not valid, | renderImage() is called, whenever the image cache is not valid, | |||
or the scales, or the size of the canvas has changed. This type | 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 | of cache is only useful for improving the performance of hide/show | |||
operations. All other situations are already handled by the | operations. All other situations are already handled by the | |||
plot canvas cache. | plot canvas cache. | |||
- ScreenCache\n | ||||
The screen cache is an image in size of the screen. As long as | ||||
the scales don't change the target image is scaled from the cache. | ||||
This might improve the performance | ||||
when resizing the plot widget, but suffers from scaling effects. | ||||
The default policy is NoCache | The default policy is NoCache | |||
*/ | */ | |||
enum CachePolicy | enum CachePolicy | |||
{ | { | |||
NoCache, | NoCache, | |||
PaintCache, | PaintCache | |||
ScreenCache | }; | |||
/*! | ||||
Attributes to modify the drawing algorithm. | ||||
\sa setPaintAttribute(), testPaintAttribute() | ||||
*/ | ||||
enum PaintAttribute | ||||
{ | ||||
/*! | ||||
When the image is rendered according to the data pixels | ||||
( QwtRasterData::pixelHint() ) it can be expanded to paint | ||||
device resolution before it is passed to QPainter. | ||||
The expansion algorithm rounds the pixel borders in the same | ||||
way as the axis ticks, what is usually better than the | ||||
scaling algorithm implemented in Qt. | ||||
Disabling this flag might make sense, to reduce the size of a | ||||
document/file. If this is possible for a document format | ||||
depends on the implementation of the specific QPaintEngine. | ||||
*/ | ||||
PaintInDeviceResolution = 1 | ||||
}; | }; | |||
explicit QwtPlotRasterItem(const QString& title = QString::null); | //! Paint attributes | |||
explicit QwtPlotRasterItem(const QwtText& title); | typedef QFlags<PaintAttribute> PaintAttributes; | |||
explicit QwtPlotRasterItem( const QString& title = QString::null ); | ||||
explicit QwtPlotRasterItem( const QwtText& title ); | ||||
virtual ~QwtPlotRasterItem(); | virtual ~QwtPlotRasterItem(); | |||
void setAlpha(int alpha); | void setPaintAttribute( PaintAttribute, bool on = true ); | |||
bool testPaintAttribute( PaintAttribute ) const; | ||||
void setAlpha( int alpha ); | ||||
int alpha() const; | int alpha() const; | |||
void setCachePolicy(CachePolicy); | void setCachePolicy( CachePolicy ); | |||
CachePolicy cachePolicy() const; | CachePolicy cachePolicy() const; | |||
void invalidateCache(); | void invalidateCache(); | |||
virtual void draw(QPainter *p, | virtual void draw( QPainter *p, | |||
const QwtScaleMap &xMap, const QwtScaleMap &yMap, | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |||
const QRect &rect) const; | const QRectF &rect ) const; | |||
virtual QSize rasterHint(const QwtDoubleRect &) const; | virtual QRectF pixelHint( const QRectF & ) const; | |||
protected: | virtual QwtInterval interval(Qt::Axis) const; | |||
virtual QRectF boundingRect() const; | ||||
/*! | protected: | |||
Renders an image for an area | /*! | |||
\brief Render an image | ||||
The format of the image must be QImage::Format_Indexed8, | An implementation of render() might iterate over all | |||
QImage::Format_RGB32 or QImage::Format_ARGB32 | pixels of imageRect. Each pixel has to be translated into | |||
the corresponding position in scale coordinates using the maps. | ||||
This position can be used to look up a value in a implementation | ||||
specific way and to map it into a color. | ||||
\param xMap Maps x-values into pixel coordinates. | \param xMap X-Scale Map | |||
\param yMap Maps y-values into pixel coordinates. | \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 | ||||
*/ | */ | |||
virtual QImage renderImage(const QwtScaleMap &xMap, | virtual QImage renderImage( const QwtScaleMap &xMap, | |||
const QwtScaleMap &yMap, const QwtDoubleRect &area | const QwtScaleMap &yMap, const QRectF &area, | |||
) const = 0; | const QSize &imageSize ) const = 0; | |||
virtual QwtScaleMap imageMap( Qt::Orientation, | ||||
const QwtScaleMap &map, const QRectF &area, | ||||
const QSize &imageSize, double pixelSize) const; | ||||
private: | private: | |||
QwtPlotRasterItem( const QwtPlotRasterItem & ); | QwtPlotRasterItem( const QwtPlotRasterItem & ); | |||
QwtPlotRasterItem &operator=( const QwtPlotRasterItem & ); | QwtPlotRasterItem &operator=( const QwtPlotRasterItem & ); | |||
void init(); | void init(); | |||
QImage compose( const QwtScaleMap &, const QwtScaleMap &, | ||||
const QRectF &imageArea, const QRectF &paintRect, | ||||
const QSize &imageSize, bool doCache) const; | ||||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotRasterItem::PaintAttributes ); | ||||
#endif | #endif | |||
End of changes. 18 change blocks. | ||||
26 lines changed or deleted | 64 lines changed or added | |||
qwt_plot_rescaler.h | qwt_plot_rescaler.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_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_double_rect.h" | #include "qwt_interval.h" | |||
#include "qwt_double_interval.h" | ||||
#include "qwt_plot.h" | #include "qwt_plot.h" | |||
#include <qobject.h> | #include <qobject.h> | |||
class QwtPlotCanvas; | class QwtPlotCanvas; | |||
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 autoadjusts 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: | |||
/*! | /*! | |||
\brief Rescale Policy | The rescale policy defines how to rescale the reference axis and | |||
their depending axes. | ||||
The rescale policy defines how to rescale the reference axis and | ||||
their depending axes. | ||||
- Fixed | ||||
\sa ExpandingDirection, setIntervalHint() | ||||
*/ | ||||
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, | ||||
- Expanding | /*! | |||
The interval of the reference axis will be shrinked/expanded, | The interval of the reference axis will be shrinked/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. | |||
- Fitting | */ | |||
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 | |||
their minimal interval. | their interval hint. | |||
*/ | */ | |||
enum RescalePolicy | ||||
{ | ||||
Fixed, | ||||
Expanding, | ||||
Fitting | Fitting | |||
}; | }; | |||
/*! | ||||
When rescalePolicy() is set to Expanding its direction depends | ||||
on ExpandingDirection | ||||
*/ | ||||
enum ExpandingDirection | enum ExpandingDirection | |||
{ | { | |||
//! The upper limit of the scale is adjusted | ||||
ExpandUp, | ExpandUp, | |||
//! The lower limit of the scale is adjusted | ||||
ExpandDown, | ExpandDown, | |||
//! Both limits of the scale are adjusted | ||||
ExpandBoth | ExpandBoth | |||
}; | }; | |||
explicit QwtPlotRescaler(QwtPlotCanvas *, | explicit QwtPlotRescaler( QwtPlotCanvas *, | |||
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; | |||
void setExpandingDirection(ExpandingDirection); | void setExpandingDirection( ExpandingDirection ); | |||
void setExpandingDirection(int axis, ExpandingDirection); | void setExpandingDirection( int axis, ExpandingDirection ); | |||
ExpandingDirection expandingDirection(int axis) const; | ExpandingDirection expandingDirection( int axis ) const; | |||
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 QwtDoubleInterval&); | void setIntervalHint( int axis, const QwtInterval& ); | |||
QwtDoubleInterval intervalHint(int axis) const; | QwtInterval intervalHint( int axis ) const; | |||
QwtPlotCanvas *canvas(); | QwtPlotCanvas *canvas(); | |||
const QwtPlotCanvas *canvas() const; | const QwtPlotCanvas *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 * ); | |||
virtual void rescale(const QSize &oldSize, const QSize &newSize) const; | virtual void rescale( const QSize &oldSize, const QSize &newSize ) cons | |||
virtual QwtDoubleInterval expandScale( int axis, | t; | |||
const QSize &oldSize, const QSize &newSize) const; | virtual QwtInterval expandScale( | |||
int axis, const QSize &oldSize, const QSize &newSize ) const; | ||||
virtual QwtDoubleInterval syncScale( | ||||
int axis, const QwtDoubleInterval& reference, | virtual QwtInterval syncScale( | |||
const QSize &size) const; | int axis, const QwtInterval& reference, | |||
const QSize &size ) const; | ||||
virtual void updateScales( | virtual void updateScales( | |||
QwtDoubleInterval intervals[QwtPlot::axisCnt]) const; | QwtInterval intervals[QwtPlot::axisCnt] ) const; | |||
Qt::Orientation orientation(int axis) const; | Qt::Orientation orientation( int axis ) const; | |||
QwtDoubleInterval interval(int axis) const; | QwtInterval interval( int axis ) const; | |||
QwtDoubleInterval expandInterval(const QwtDoubleInterval &, | QwtInterval expandInterval( const QwtInterval &, | |||
double width, ExpandingDirection) const; | double width, ExpandingDirection ) const; | |||
private: | private: | |||
double pixelDist(int axis, const QSize &) const; | double pixelDist( int axis, const QSize & ) const; | |||
class AxisData; | class AxisData; | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 26 change blocks. | ||||
45 lines changed or deleted | 54 lines changed or added | |||
qwt_plot_scaleitem.h | qwt_plot_scaleitem.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_SCALE_ITEM_H | #ifndef QWT_PLOT_SCALE_ITEM_H | |||
#define QWT_PLOT_SCALE_ITEM_H | #define QWT_PLOT_SCALE_ITEM_H | |||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include "qwt_plot_item.h" | #include "qwt_plot_item.h" | |||
#include "qwt_scale_draw.h" | #include "qwt_scale_draw.h" | |||
#if QT_VERSION < 0x040000 | ||||
class QColorGroup; | ||||
#else | ||||
class QPalette; | class QPalette; | |||
#endif | ||||
/*! | /*! | |||
\brief A class which draws a scale inside the plot canvas | \brief A class which draws a scale inside the plot canvas | |||
QwtPlotScaleItem can be used to draw an axis inside the plot canvas. | QwtPlotScaleItem can be used to draw an axis inside the plot canvas. | |||
It might by synchronized to one of the axis of the plot, but can | It might by synchronized to one of the axis of the plot, but can | |||
also display its own ticks and labels. | also display its own ticks and labels. | |||
It is allowed to synchronize the scale item with a disabled axis. | It is allowed to synchronize the scale item with a disabled axis. | |||
In plots with vertical and horizontal scale items, it might be | In plots with vertical and horizontal scale items, it might be | |||
skipping to change at line 56 | skipping to change at line 52 | |||
plot->enableAxis(QwtPlot::yLeft, false); | plot->enableAxis(QwtPlot::yLeft, false); | |||
\endverbatim | \endverbatim | |||
*/ | */ | |||
class QWT_EXPORT QwtPlotScaleItem: public QwtPlotItem | class QWT_EXPORT QwtPlotScaleItem: public QwtPlotItem | |||
{ | { | |||
public: | public: | |||
explicit QwtPlotScaleItem( | explicit QwtPlotScaleItem( | |||
QwtScaleDraw::Alignment = QwtScaleDraw::BottomScale, | QwtScaleDraw::Alignment = QwtScaleDraw::BottomScale, | |||
const double pos = 0.0); | const double pos = 0.0 ); | |||
virtual ~QwtPlotScaleItem(); | virtual ~QwtPlotScaleItem(); | |||
virtual int rtti() const; | virtual int rtti() const; | |||
void setScaleDiv(const QwtScaleDiv& ); | void setScaleDiv( const QwtScaleDiv& ); | |||
const QwtScaleDiv& scaleDiv() const; | const QwtScaleDiv& scaleDiv() const; | |||
void setScaleDivFromAxis(bool on); | void setScaleDivFromAxis( bool on ); | |||
bool isScaleDivFromAxis() const; | bool isScaleDivFromAxis() const; | |||
#if QT_VERSION < 0x040000 | void setPalette( const QPalette & ); | |||
void setColorGroup(const QColorGroup &); | ||||
QColorGroup colorGroup() const; | ||||
#else | ||||
void setPalette(const QPalette &); | ||||
QPalette palette() const; | QPalette palette() const; | |||
#endif | ||||
void setFont(const QFont&); | void setFont( const QFont& ); | |||
QFont font() const; | QFont font() const; | |||
void setScaleDraw(QwtScaleDraw *); | void setScaleDraw( QwtScaleDraw * ); | |||
const QwtScaleDraw *scaleDraw() const; | const QwtScaleDraw *scaleDraw() const; | |||
QwtScaleDraw *scaleDraw(); | QwtScaleDraw *scaleDraw(); | |||
void setPosition(double pos); | void setPosition( double pos ); | |||
double position() const; | double position() const; | |||
void setBorderDistance(int numPixels); | void setBorderDistance( int numPixels ); | |||
int borderDistance() const; | int borderDistance() const; | |||
void setAlignment(QwtScaleDraw::Alignment); | void setAlignment( QwtScaleDraw::Alignment ); | |||
virtual void draw(QPainter *p, | virtual void draw( QPainter *p, | |||
const QwtScaleMap &xMap, const QwtScaleMap &yMap, | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |||
const QRect &rect) const; | const QRectF &rect ) const; | |||
virtual void updateScaleDiv(const QwtScaleDiv&, | virtual void updateScaleDiv( const QwtScaleDiv &, const QwtScaleDiv & ) | |||
const QwtScaleDiv&); | ; | |||
private: | private: | |||
void updateBorders(); | ||||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 16 change blocks. | ||||
24 lines changed or deleted | 14 lines changed or added | |||
qwt_plot_spectrogram.h | qwt_plot_spectrogram.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_SPECTROGRAM_H | #ifndef QWT_PLOT_SPECTROGRAM_H | |||
#define QWT_PLOT_SPECTROGRAM_H | #define QWT_PLOT_SPECTROGRAM_H | |||
#include <qglobal.h> | #include "qwt_global.h" | |||
#include "qwt_valuelist.h" | ||||
#include "qwt_raster_data.h" | #include "qwt_raster_data.h" | |||
#include "qwt_plot_rasteritem.h" | #include "qwt_plot_rasteritem.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 threedimenional 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. | |||
skipping to change at line 40 | skipping to change at line 39 | |||
\image html spectrogram3.png | \image html spectrogram3.png | |||
\sa QwtRasterData, QwtColorMap | \sa QwtRasterData, QwtColorMap | |||
*/ | */ | |||
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. | |||
- ImageMode\n | ||||
The values are mapped to colors using a color map. | ||||
- ContourMode\n | ||||
The data is displayed using contour lines | ||||
When both modes are enabled the contour lines are painted on | ||||
top of the spectrogram. The default setting enables ImageMode. | ||||
\sa setDisplayMode(), testDisplayMode() | \sa setDisplayMode(), testDisplayMode() | |||
*/ | */ | |||
enum DisplayMode | enum DisplayMode | |||
{ | { | |||
ImageMode = 1, | //! The values are mapped to colors using a color map. | |||
ContourMode = 2 | ImageMode = 0x01, | |||
//! The data is displayed using contour lines | ||||
ContourMode = 0x02 | ||||
}; | }; | |||
explicit QwtPlotSpectrogram(const QString &title = QString::null); | //! Display modes | |||
typedef QFlags<DisplayMode> DisplayModes; | ||||
explicit QwtPlotSpectrogram( const QString &title = QString::null ); | ||||
virtual ~QwtPlotSpectrogram(); | virtual ~QwtPlotSpectrogram(); | |||
void setDisplayMode(DisplayMode, bool on = true); | void setRenderThreadCount( uint numThreads ); | |||
bool testDisplayMode(DisplayMode) const; | uint renderThreadCount() const; | |||
void setDisplayMode( DisplayMode, bool on = true ); | ||||
bool testDisplayMode( DisplayMode ) const; | ||||
void setData(const QwtRasterData &data); | void setData( QwtRasterData *data ); | |||
const QwtRasterData &data() const; | const QwtRasterData *data() const; | |||
QwtRasterData *data(); | ||||
void setColorMap(const QwtColorMap &); | void setColorMap( QwtColorMap * ); | |||
const QwtColorMap &colorMap() const; | const QwtColorMap *colorMap() const; | |||
virtual QwtDoubleRect boundingRect() const; | virtual QwtInterval interval(Qt::Axis) const; | |||
virtual QSize rasterHint(const QwtDoubleRect &) const; | virtual QRectF pixelHint( const QRectF & ) const; | |||
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 setConrecAttribute(QwtRasterData::ConrecAttribute, bool on); | void setConrecFlag( QwtRasterData::ConrecFlag, bool on ); | |||
bool testConrecAttribute(QwtRasterData::ConrecAttribute) const; | bool testConrecFlag( QwtRasterData::ConrecFlag ) const; | |||
void setContourLevels(const QwtValueList &); | void setContourLevels( const QList<double> & ); | |||
QwtValueList contourLevels() const; | QList<double> contourLevels() const; | |||
virtual int rtti() const; | virtual int rtti() const; | |||
virtual void draw(QPainter *p, | virtual void draw( QPainter *p, | |||
const QwtScaleMap &xMap, const QwtScaleMap &yMap, | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |||
const QRect &rect) const; | const QRectF &rect ) const; | |||
protected: | protected: | |||
virtual QImage renderImage( | virtual QImage renderImage( | |||
const QwtScaleMap &xMap, const QwtScaleMap &yMap, | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |||
const QwtDoubleRect &rect) const; | const QRectF &area, const QSize &imageSize ) const; | |||
virtual QSize contourRasterSize( | virtual QSize contourRasterSize( | |||
const QwtDoubleRect &, const QRect &) const; | const QRectF &, const QRect & ) const; | |||
virtual QwtRasterData::ContourLines renderContourLines( | virtual QwtRasterData::ContourLines renderContourLines( | |||
const QwtDoubleRect &rect, const QSize &raster) const; | const QRectF &rect, const QSize &raster ) const; | |||
virtual void drawContourLines(QPainter *p, | virtual void drawContourLines( QPainter *p, | |||
const QwtScaleMap &xMap, const QwtScaleMap &yMap, | const QwtScaleMap &xMap, const QwtScaleMap &yMap, | |||
const QwtRasterData::ContourLines& lines) const; | const QwtRasterData::ContourLines& lines ) const; | |||
void renderTile( const QwtScaleMap &xMap, const QwtScaleMap &yMap, | ||||
const QRect &imageRect, QImage *image ) const; | ||||
private: | private: | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotSpectrogram::DisplayModes ); | ||||
#endif | #endif | |||
End of changes. 21 change blocks. | ||||
35 lines changed or deleted | 41 lines changed or added | |||
qwt_plot_zoomer.h | qwt_plot_zoomer.h | |||
---|---|---|---|---|
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | |||
* Qwt Widget Library | * Qwt Widget Library | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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 | |||
************************************************************************** ***/ | ************************************************************************** ***/ | |||
// vim: expandtab | ||||
#ifndef QWT_PLOT_ZOOMER_H | #ifndef QWT_PLOT_ZOOMER_H | |||
#define QWT_PLOT_ZOOMER_H | #define QWT_PLOT_ZOOMER_H | |||
#include <qglobal.h> | #include "qwt_global.h" | |||
#if QT_VERSION < 0x040000 | ||||
#include <qvaluestack.h> | ||||
#else | ||||
#include <qstack.h> | ||||
#endif | ||||
#include "qwt_double_rect.h" | ||||
#include "qwt_plot_picker.h" | #include "qwt_plot_picker.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 offers rubberband selections on the plot canvas, | |||
translating the selected rectangles into plot coordinates and | translating the selected rectangles into plot coordinates and | |||
adjusting the axes to them. Zooming can repeated as often as | adjusting the axes to them. Zooming can repeated as often as | |||
possible, limited only by maxStackDepth() or minZoomSize(). | possible, limited only by maxStackDepth() or minZoomSize(). | |||
Each rectangle is pushed on a stack. | Each rectangle is pushed on a stack. | |||
Zoom rectangles can be selected depending on selectionFlags() using the | Zoom rectangles can be selected depending on selectionFlags() using the | |||
mouse or keyboard (QwtEventPattern, QwtPickerMachine). | mouse or keyboard (QwtEventPattern, QwtPickerMachine). | |||
QwtEventPattern::MouseSelect3/QwtEventPattern::KeyUndo, | QwtEventPattern::MouseSelect3,QwtEventPattern::KeyUndo, | |||
or QwtEventPattern::MouseSelect6/QwtEventPattern::KeyRedo | or QwtEventPattern::MouseSelect6,QwtEventPattern::KeyRedo | |||
walk up and down the zoom stack. | walk up and down the zoom stack. | |||
QwtEventPattern::MouseSelect2 or QwtEventPattern::KeyHome unzoom to | QwtEventPattern::MouseSelect2 or QwtEventPattern::KeyHome unzoom to | |||
the initial size. | the initial size. | |||
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 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. | |||
*/ | */ | |||
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( QwtPlotCanvas *, bool doReplot = true ); | |||
explicit QwtPlotZoomer(int xAxis, int yAxis, | explicit QwtPlotZoomer( int xAxis, int yAxis, | |||
QwtPlotCanvas *, bool doReplot = true); | QwtPlotCanvas *, bool doReplot = true ); | |||
explicit QwtPlotZoomer(int xAxis, int yAxis, int selectionFlags, | ||||
DisplayMode trackerMode, QwtPlotCanvas *, | ||||
bool doReplot = true); | ||||
virtual ~QwtPlotZoomer(); | virtual ~QwtPlotZoomer(); | |||
virtual void setZoomBase(bool doReplot = true); | virtual void setZoomBase( bool doReplot = true ); | |||
virtual void setZoomBase(const QwtDoubleRect &); | virtual void setZoomBase( const QRectF & ); | |||
QwtDoubleRect zoomBase() const; | QRectF zoomBase() const; | |||
QwtDoubleRect zoomRect() const; | QRectF zoomRect() const; | |||
virtual void setAxis(int xAxis, int yAxis); | virtual void setAxis( int xAxis, int yAxis ); | |||
void setMaxStackDepth(int); | void setMaxStackDepth( int ); | |||
int maxStackDepth() const; | int maxStackDepth() const; | |||
#if QT_VERSION < 0x040000 | const QStack<QRectF> &zoomStack() const; | |||
const QValueStack<QwtDoubleRect> &zoomStack() const; | void setZoomStack( const QStack<QRectF> &, | |||
void setZoomStack(const QValueStack<QwtDoubleRect> &, | int zoomRectIndex = -1 ); | |||
int zoomRectIndex = -1); | ||||
#else | ||||
const QStack<QwtDoubleRect> &zoomStack() const; | ||||
void setZoomStack(const QStack<QwtDoubleRect> &, | ||||
int zoomRectIndex = -1); | ||||
#endif | ||||
uint zoomRectIndex() const; | ||||
virtual void setSelectionFlags(int); | uint zoomRectIndex() const; | |||
public slots: | public Q_SLOTS: | |||
void moveBy(double x, double y); | void moveBy( double x, double y ); | |||
virtual void move(double x, double y); | virtual void moveTo( const QPointF & ); | |||
virtual void zoom(const QwtDoubleRect &); | virtual void zoom( const QRectF & ); | |||
virtual void zoom(int up); | virtual void zoom( int up ); | |||
signals: | Q_SIGNALS: | |||
/*! | /*! | |||
A signal emitting the zoomRect(), when the plot has been | A signal emitting the zoomRect(), when the plot has been | |||
zoomed in or out. | zoomed in or out. | |||
\param rect Current zoom rectangle. | \param rect Current zoom rectangle. | |||
*/ | */ | |||
void zoomed(const QwtDoubleRect &rect); | void zoomed( const QRectF &rect ); | |||
protected: | protected: | |||
virtual void rescale(); | virtual void rescale(); | |||
virtual QwtDoubleSize minZoomSize() const; | virtual QSizeF minZoomSize() const; | |||
virtual void widgetMouseReleaseEvent(QMouseEvent *); | virtual void widgetMouseReleaseEvent( QMouseEvent * ); | |||
virtual void widgetKeyPressEvent(QKeyEvent *); | virtual void widgetKeyPressEvent( QKeyEvent * ); | |||
virtual void begin(); | virtual void begin(); | |||
virtual bool end(bool ok = true); | virtual bool end( bool ok = true ); | |||
virtual bool accept(QwtPolygon &) const; | virtual bool accept( QPolygon & ) const; | |||
private: | private: | |||
void init(int selectionFlags, DisplayMode trackerMode, bool doReplot); | void init( bool doReplot ); | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 19 change blocks. | ||||
48 lines changed or deleted | 30 lines changed or added | |||
qwt_raster_data.h | qwt_raster_data.h | |||
---|---|---|---|---|
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | |||
* Qwt Widget Library | * Qwt Widget Library | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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 | |||
************************************************************************** ***/ | ************************************************************************** ***/ | |||
// vim: expandtab | ||||
#ifndef QWT_RASTER_DATA_H | #ifndef QWT_RASTER_DATA_H | |||
#define QWT_RASTER_DATA_H 1 | #define QWT_RASTER_DATA_H 1 | |||
#include <qmap.h> | ||||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include "qwt_double_rect.h" | #include "qwt_interval.h" | |||
#include "qwt_double_interval.h" | #include <qmap.h> | |||
#if QT_VERSION >= 0x040000 | ||||
#include <qlist.h> | #include <qlist.h> | |||
#include <QPolygonF> | #include <qpolygon.h> | |||
#if defined(QWT_TEMPLATEDLL) | ||||
// MOC_SKIP_BEGIN | ||||
template class QWT_EXPORT QMap<double, QPolygonF>; | ||||
// MOC_SKIP_END | ||||
#endif | ||||
#else | ||||
#include <qvaluelist.h> | ||||
#include "qwt_array.h" | ||||
#include "qwt_double_rect.h" | ||||
#if defined(QWT_TEMPLATEDLL) | ||||
// MOC_SKIP_BEGIN | ||||
#ifndef QWTARRAY_TEMPLATE_QWTDOUBLEPOINT // by mjo3 | ||||
#define QWTARRAY_TEMPLATE_QWTDOUBLEPOINT | ||||
template class QWT_EXPORT QwtArray<QwtDoublePoint>; | ||||
#endif //end of QWTARRAY_TEMPLATE_QWTDOUBLEPOINT | ||||
#ifndef QMAP_TEMPLATE_DOUBLE_QWTDOUBLEPOINT // by mjo3 | ||||
#define QMAP_TEMPLATE_DOUBLE_QWTDOUBLEPOINT | ||||
template class QWT_EXPORT QMap<double, QwtArray<QwtDoublePoint> >; | ||||
#endif //end of QMAP_TEMPLATE_QWTDOUBLEPOINT | ||||
// MOC_SKIP_END | ||||
#endif | ||||
#endif | ||||
class QwtScaleMap; | class QwtScaleMap; | |||
/*! | /*! | |||
\brief QwtRasterData defines an interface to any type of raster data. | \brief QwtRasterData defines an interface to any type of raster data. | |||
QwtRasterData is an abstract interface, that is used by | QwtRasterData is an abstract interface, that is used by | |||
QwtPlotRasterItem to find the values at the pixels of its raster. | QwtPlotRasterItem to find the values at the pixels of its raster. | |||
Often a raster item is used to display values from a matrix. Then the | Often a raster item is used to display values from a matrix. Then the | |||
derived raster data class needs to implement some sort of resampling, | derived raster data class needs to implement some sort of resampling, | |||
that maps the raster of the matrix into the requested raster of | that maps the raster of the matrix into the requested raster of | |||
the raster item ( depending on resolution and scales of the canvas ). | the raster item ( depending on resolution and scales of the canvas ). | |||
*/ | */ | |||
class QWT_EXPORT QwtRasterData | class QWT_EXPORT QwtRasterData | |||
{ | { | |||
public: | public: | |||
#if QT_VERSION >= 0x040000 | //! Contour lines | |||
typedef QMap<double, QPolygonF> ContourLines; | typedef QMap<double, QPolygonF> ContourLines; | |||
#else | ||||
typedef QMap<double, QwtArray<QwtDoublePoint> > ContourLines; | ||||
#endif | ||||
//! Attribute to modify the contour algorithm | //! Flags to modify the contour algorithm | |||
enum ConrecAttribute | enum ConrecFlag | |||
{ | { | |||
IgnoreAllVerticesOnLevel = 1, | //! Ignore all verices on the same level | |||
IgnoreOutOfRange = 2 | IgnoreAllVerticesOnLevel = 0x01, | |||
//! Ignore all values, that are out of range | ||||
IgnoreOutOfRange = 0x02 | ||||
}; | }; | |||
//! Flags to modify the contour algorithm | ||||
typedef QFlags<ConrecFlag> ConrecFlags; | ||||
QwtRasterData(); | QwtRasterData(); | |||
QwtRasterData(const QwtDoubleRect &); | ||||
virtual ~QwtRasterData(); | virtual ~QwtRasterData(); | |||
//! Clone the data | virtual void setInterval( Qt::Axis, const QwtInterval & ); | |||
virtual QwtRasterData *copy() const = 0; | const QwtInterval &interval(Qt::Axis) const; | |||
virtual void setBoundingRect(const QwtDoubleRect &); | ||||
QwtDoubleRect boundingRect() const; | ||||
virtual QSize rasterHint(const QwtDoubleRect &) const; | virtual QRectF pixelHint( const QRectF & ) const; | |||
virtual void initRaster(const QwtDoubleRect &, const QSize& raster); | virtual void initRaster( const QRectF &, const QSize& raster ); | |||
virtual void discardRaster(); | virtual void discardRaster(); | |||
/*! | /*! | |||
\return the value at a raster position | \return the value at a raster position | |||
\param x X value in plot coordinates | \param x X value in plot coordinates | |||
\param y Y value in plot coordinates | \param y Y value in plot coordinates | |||
*/ | */ | |||
virtual double value(double x, double y) const = 0; | virtual double value( double x, double y ) const = 0; | |||
//! \return the range of the values | ||||
virtual QwtDoubleInterval range() const = 0; | ||||
#if QT_VERSION >= 0x040000 | virtual ContourLines contourLines( const QRectF &rect, | |||
virtual ContourLines contourLines(const QwtDoubleRect &rect, | ||||
const QSize &raster, const QList<double> &levels, | const QSize &raster, const QList<double> &levels, | |||
int flags) const; | ConrecFlags ) const; | |||
#else | ||||
virtual ContourLines contourLines(const QwtDoubleRect &rect, | ||||
const QSize &raster, const QValueList<double> &levels, | ||||
int flags) const; | ||||
#endif | ||||
class Contour3DPoint; | class Contour3DPoint; | |||
class ContourPlane; | class ContourPlane; | |||
private: | private: | |||
QwtDoubleRect d_boundingRect; | // Disabled copy constructor and operator= | |||
QwtRasterData( const QwtRasterData & ); | ||||
QwtRasterData &operator=( const QwtRasterData & ); | ||||
QwtInterval d_intervals[3]; | ||||
}; | }; | |||
/*! | ||||
\return Bounding interval for a axis | ||||
\sa setInterval | ||||
*/ | ||||
inline const QwtInterval &QwtRasterData::interval( Qt::Axis axis) const | ||||
{ | ||||
return d_intervals[axis]; | ||||
} | ||||
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtRasterData::ConrecFlags ); | ||||
#endif | #endif | |||
End of changes. 18 change blocks. | ||||
61 lines changed or deleted | 37 lines changed or added | |||
qwt_round_scale_draw.h | qwt_round_scale_draw.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_ROUND_SCALE_DRAW_H | #ifndef QWT_ROUND_SCALE_DRAW_H | |||
#define QWT_ROUND_SCALE_DRAW_H | #define QWT_ROUND_SCALE_DRAW_H | |||
#include <qpoint.h> | ||||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include "qwt_abstract_scale_draw.h" | #include "qwt_abstract_scale_draw.h" | |||
#include <qpoint.h> | ||||
class QPen; | 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 QwtRoundScaleDraw::setAngleRange(). | |||
The geometry of the scale can be specified with | The geometry of the scale can be specified with | |||
QwtRoundScaleDraw::moveCenter() and QwtRoundScaleDraw::setRadius(). | QwtRoundScaleDraw::moveCenter() and QwtRoundScaleDraw::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(); | |||
QwtRoundScaleDraw(const QwtRoundScaleDraw &); | ||||
virtual ~QwtRoundScaleDraw(); | virtual ~QwtRoundScaleDraw(); | |||
QwtRoundScaleDraw &operator=(const QwtRoundScaleDraw &other); | void setRadius( int radius ); | |||
void setRadius(int radius); | ||||
int radius() const; | int radius() const; | |||
void moveCenter(int x, int y); | void moveCenter( double x, double y ); | |||
void moveCenter(const QPoint &); | void moveCenter( const QPointF & ); | |||
QPoint center() const; | QPointF center() const; | |||
void setAngleRange(double angle1, double angle2); | void setAngleRange( double angle1, double angle2 ); | |||
virtual int extent(const QPen &, const QFont &) const; | virtual double extent( const QFont & ) const; | |||
protected: | protected: | |||
virtual void drawTick(QPainter *p, double val, int len) const; | virtual void drawTick( QPainter *p, double val, double len ) const; | |||
virtual void drawBackbone(QPainter *p) const; | virtual void drawBackbone( QPainter *p ) const; | |||
virtual void drawLabel(QPainter *p, double val) const; | virtual void drawLabel( QPainter *p, double val ) const; | |||
private: | private: | |||
QwtRoundScaleDraw( const QwtRoundScaleDraw & ); | ||||
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 | |||
inline void QwtRoundScaleDraw::moveCenter(int x, int y) | inline void QwtRoundScaleDraw::moveCenter( double x, double y ) | |||
{ | { | |||
moveCenter(QPoint(x, y)); | moveCenter( QPointF( x, y ) ); | |||
} | } | |||
#endif | #endif | |||
End of changes. 11 change blocks. | ||||
16 lines changed or deleted | 15 lines changed or added | |||
qwt_scale_div.h | qwt_scale_div.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_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_valuelist.h" | #include "qwt_interval.h" | |||
#include "qwt_double_interval.h" | #include <qlist.h> | |||
class QwtDoubleInterval; | class QwtInterval; | |||
/*! | /*! | |||
\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 scale division consists of its limits and 3 list | |||
of tick values qualified as major, medium and minor ticks. | of tick values qualified as major, medium and minor ticks. | |||
In most cases scale divisions are calculated by a QwtScaleEngine. | In most cases scale divisions are calculated by a QwtScaleEngine. | |||
\sa subDivideInto(), subDivide() | \sa subDivideInto(), subDivide() | |||
*/ | */ | |||
class QWT_EXPORT QwtScaleDiv | class QWT_EXPORT QwtScaleDiv | |||
{ | { | |||
public: | public: | |||
//! Scale tick types | //! Scale tick types | |||
enum TickType | enum TickType | |||
{ | { | |||
//! No ticks | ||||
NoTick = -1, | NoTick = -1, | |||
//! Minor ticks | ||||
MinorTick, | MinorTick, | |||
//! Medium ticks | ||||
MediumTick, | MediumTick, | |||
//! Major ticks | ||||
MajorTick, | MajorTick, | |||
//! Number of valid tick types | ||||
NTickTypes | NTickTypes | |||
}; | }; | |||
explicit QwtScaleDiv(); | explicit QwtScaleDiv(); | |||
explicit QwtScaleDiv(const QwtDoubleInterval &, | explicit QwtScaleDiv( const QwtInterval &, QList<double>[NTickTypes] ); | |||
QwtValueList[NTickTypes]); | explicit QwtScaleDiv( | |||
explicit QwtScaleDiv(double lowerBound, double upperBound, | double lowerBound, double upperBound, QList<double>[NTickTypes] ); | |||
QwtValueList[NTickTypes]); | ||||
bool operator==( const QwtScaleDiv &s ) const; | ||||
int operator==(const QwtScaleDiv &s) const; | bool operator!=( const QwtScaleDiv &s ) const; | |||
int operator!=(const QwtScaleDiv &s) const; | ||||
void setInterval( double lowerBound, double upperBound ); | ||||
void setInterval(double lowerBound, double upperBound); | void setInterval( const QwtInterval & ); | |||
void setInterval(const QwtDoubleInterval &); | QwtInterval interval() const; | |||
QwtDoubleInterval interval() const; | ||||
double lowerBound() const; | double lowerBound() const; | |||
double upperBound() const; | double upperBound() const; | |||
double range() const; | double range() const; | |||
bool contains(double v) const; | bool contains( double v ) const; | |||
void setTicks(int type, const QwtValueList &); | void setTicks( int type, const QList<double> & ); | |||
const QwtValueList &ticks(int type) const; | const QList<double> &ticks( int type ) const; | |||
void invalidate(); | void invalidate(); | |||
bool isValid() const; | bool isValid() const; | |||
void invert(); | void invert(); | |||
private: | private: | |||
double d_lowerBound; | double d_lowerBound; | |||
double d_upperBound; | double d_upperBound; | |||
QwtValueList d_ticks[NTickTypes]; | QList<double> d_ticks[NTickTypes]; | |||
bool d_isValid; | bool d_isValid; | |||
}; | }; | |||
Q_DECLARE_TYPEINFO(QwtScaleDiv, Q_MOVABLE_TYPE); | ||||
/*! | /*! | |||
Change the interval | Change the interval | |||
\param lowerBound lower bound | \param lowerBound lower bound | |||
\param upperBound upper bound | \param upperBound upper bound | |||
*/ | */ | |||
inline void QwtScaleDiv::setInterval(double lowerBound, double upperBound) | inline void QwtScaleDiv::setInterval( double lowerBound, double upperBound ) | |||
{ | { | |||
d_lowerBound = lowerBound; | d_lowerBound = lowerBound; | |||
d_upperBound = upperBound; | d_upperBound = upperBound; | |||
} | } | |||
/*! | /*! | |||
\return lowerBound -> upperBound | \return lowerBound -> upperBound | |||
*/ | */ | |||
inline QwtDoubleInterval QwtScaleDiv::interval() const | inline QwtInterval QwtScaleDiv::interval() const | |||
{ | { | |||
return QwtDoubleInterval(d_lowerBound, d_upperBound); | return QwtInterval( d_lowerBound, d_upperBound ); | |||
} | } | |||
/*! | /*! | |||
\return lower bound | \return lower bound | |||
\sa upperBound() | \sa upperBound() | |||
*/ | */ | |||
inline double QwtScaleDiv::lowerBound() const | inline double QwtScaleDiv::lowerBound() const | |||
{ | { | |||
return d_lowerBound; | return d_lowerBound; | |||
} | } | |||
End of changes. 15 change blocks. | ||||
21 lines changed or deleted | 29 lines changed or added | |||
qwt_scale_draw.h | qwt_scale_draw.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_DRAW_H | #ifndef QWT_SCALE_DRAW_H | |||
#define QWT_SCALE_DRAW_H | #define QWT_SCALE_DRAW_H | |||
#include <qpoint.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 <qrect.h> | ||||
#include <qtransform.h> | ||||
/*! | /*! | |||
\brief A class for drawing scales | \brief A class for drawing scales | |||
QwtScaleDraw can be used to draw linear or logarithmic scales. | QwtScaleDraw can be used to draw linear or logarithmic scales. | |||
A scale has a position, an alignment and a length, which can be specified . | A scale has a position, an alignment and a length, which can be specified . | |||
The labels can be rotated and aligned | The labels can be rotated and aligned | |||
to the ticks using setLabelRotation() and setLabelAlignment(). | to the ticks using setLabelRotation() and setLabelAlignment(). | |||
After a scale division has been specified as a QwtScaleDiv object | After a scale division has been specified as a QwtScaleDiv object | |||
skipping to change at line 37 | skipping to change at line 39 | |||
the scale can be drawn with the QwtAbstractScaleDraw::draw() member. | the scale can be drawn with the QwtAbstractScaleDraw::draw() member. | |||
*/ | */ | |||
class QWT_EXPORT QwtScaleDraw: public QwtAbstractScaleDraw | class QWT_EXPORT QwtScaleDraw: public QwtAbstractScaleDraw | |||
{ | { | |||
public: | public: | |||
/*! | /*! | |||
Alignment of the scale draw | Alignment of the scale draw | |||
\sa setAlignment(), alignment() | \sa setAlignment(), alignment() | |||
*/ | */ | |||
enum Alignment { BottomScale, TopScale, LeftScale, RightScale }; | enum Alignment | |||
{ | ||||
//! The scale is below | ||||
BottomScale, | ||||
//! The scale is above | ||||
TopScale, | ||||
//! The scale is left | ||||
LeftScale, | ||||
//! The scale is right | ||||
RightScale | ||||
}; | ||||
QwtScaleDraw(); | QwtScaleDraw(); | |||
QwtScaleDraw(const QwtScaleDraw &); | ||||
virtual ~QwtScaleDraw(); | virtual ~QwtScaleDraw(); | |||
QwtScaleDraw &operator=(const QwtScaleDraw &other); | void getBorderDistHint( const QFont &, int &start, int &end ) const; | |||
int minLabelDist( const QFont & ) const; | ||||
void getBorderDistHint(const QFont &, int &start, int &end) const; | ||||
int minLabelDist(const QFont &) const; | ||||
int minLength(const QPen &, const QFont &) const; | int minLength( const QFont & ) const; | |||
virtual int extent(const QPen &, const QFont &) const; | virtual double extent( const QFont & ) const; | |||
void move(int x, int y); | void move( double x, double y ); | |||
void move(const QPoint &); | void move( const QPointF & ); | |||
void setLength(int length); | void setLength( double length ); | |||
Alignment alignment() const; | Alignment alignment() const; | |||
void setAlignment(Alignment); | void setAlignment( Alignment ); | |||
Qt::Orientation orientation() const; | Qt::Orientation orientation() const; | |||
QPoint pos() const; | QPointF pos() const; | |||
int length() const; | double length() const; | |||
#if QT_VERSION < 0x040000 | void setLabelAlignment( Qt::Alignment ); | |||
void setLabelAlignment(int); | ||||
int labelAlignment() const; | ||||
#else | ||||
void setLabelAlignment(Qt::Alignment); | ||||
Qt::Alignment labelAlignment() const; | Qt::Alignment labelAlignment() const; | |||
#endif | ||||
void setLabelRotation(double rotation); | void setLabelRotation( double rotation ); | |||
double labelRotation() const; | double labelRotation() const; | |||
int maxLabelHeight(const QFont &) const; | int maxLabelHeight( const QFont & ) const; | |||
int maxLabelWidth(const QFont &) const; | int maxLabelWidth( const QFont & ) const; | |||
QPoint labelPosition(double val) const; | QPointF labelPosition( double val ) const; | |||
QRect labelRect(const QFont &, double val) const; | QRectF labelRect( const QFont &, double val ) const; | |||
QSize labelSize(const QFont &, double val) const; | QSizeF labelSize( const QFont &, double val ) const; | |||
QRect boundingLabelRect(const QFont &, double val) const; | QRect boundingLabelRect( const QFont &, double val ) const; | |||
protected: | protected: | |||
QTransform labelTransformation( const QPointF &, const QSizeF & ) const ; | ||||
#if QT_VERSION < 0x040000 | virtual void drawTick( QPainter *, double val, double len ) const; | |||
QWMatrix labelMatrix(const QPoint &, const QSize &) const; | virtual void drawBackbone( QPainter * ) const; | |||
#else | virtual void drawLabel( QPainter *, double val ) const; | |||
QMatrix labelMatrix(const QPoint &, const QSize &) const; | ||||
#endif | ||||
virtual void drawTick(QPainter *p, double val, int len) const; | ||||
virtual void drawBackbone(QPainter *p) const; | ||||
virtual void drawLabel(QPainter *p, double val) const; | ||||
private: | private: | |||
QwtScaleDraw( const QwtScaleDraw & ); | ||||
QwtScaleDraw &operator=( const QwtScaleDraw &other ); | ||||
void updateMap(); | void updateMap(); | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
/*! | /*! | |||
Move the position of the scale | Move the position of the scale | |||
\sa move(const QPoint &) | \sa move(const QPointF &) | |||
*/ | */ | |||
inline void QwtScaleDraw::move(int x, int y) | inline void QwtScaleDraw::move( double x, double y ) | |||
{ | { | |||
move(QPoint(x, y)); | move( QPointF( x, y ) ); | |||
} | } | |||
#endif | #endif | |||
End of changes. 22 change blocks. | ||||
41 lines changed or deleted | 45 lines changed or added | |||
qwt_scale_engine.h | qwt_scale_engine.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_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_double_interval.h" | #include "qwt_interval.h" | |||
class QwtScaleTransformation; | class QwtScaleTransformation; | |||
/*! | /*! | |||
\brief Arithmetic including a tolerance | \brief Arithmetic including a tolerance | |||
*/ | */ | |||
class QWT_EXPORT QwtScaleArithmetic | class QWT_EXPORT QwtScaleArithmetic | |||
{ | { | |||
public: | public: | |||
static int compareEps( | static double ceilEps( double value, double intervalSize ); | |||
double value1, double value2, double intervalSize); | static double floorEps( double value, double intervalSize ); | |||
static double ceilEps(double value, double intervalSize); | static double divideEps( double interval, double steps ); | |||
static double floorEps(double value, double intervalSize); | ||||
static double divideEps(double interval, double steps); | static double ceil125( double x ); | |||
static double floor125( double x ); | ||||
static double ceil125(double x); | ||||
static double floor125(double x); | ||||
}; | }; | |||
/*! | /*! | |||
\brief Base class for scale engines. | \brief Base class for scale engines. | |||
A scale engine trys to find "reasonable" ranges and step sizes | A scale engine trys 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 (log10) | |||
and linear scales. Contributions for other types of scale engines | and linear scales. Contributions for other types of scale engines | |||
(date/time, log2 ... ) are welcome. | (date/time, log2 ... ) are welcome. | |||
*/ | */ | |||
class QWT_EXPORT QwtScaleEngine | class QWT_EXPORT QwtScaleEngine | |||
{ | { | |||
public: | public: | |||
/*! | /*! | |||
- IncludeReference\n | Layout attributes | |||
Build a scale which includes the reference() value. | ||||
- Symmetric\n | ||||
Build a scale which is symmetric to the reference() value. | ||||
- Floating\n | ||||
The endpoints of the scale are supposed to be equal the | ||||
outmost included values plus the specified margins (see setMargins | ||||
()). If this attribute is *not* set, the endpoints of the scale wi | ||||
ll | ||||
be integer multiples of the step size. | ||||
- Inverted\n | ||||
Turn the scale upside down. | ||||
\sa setAttribute(), testAttribute(), reference(), | \sa setAttribute(), testAttribute(), reference(), | |||
lowerMargin(), upperMargin() | lowerMargin(), upperMargin() | |||
*/ | */ | |||
enum Attribute | enum Attribute | |||
{ | { | |||
NoAttribute = 0, | //! No attributes | |||
IncludeReference = 1, | NoAttribute = 0x00, | |||
Symmetric = 2, | ||||
Floating = 4, | //! Build a scale which includes the reference() value. | |||
Inverted = 8 | IncludeReference = 0x01, | |||
//! Build a scale which is symmetric to the reference() value. | ||||
Symmetric = 0x02, | ||||
/*! | ||||
The endpoints of the scale are supposed to be equal the | ||||
outmost included values plus the specified margins | ||||
(see setMargins()). | ||||
If this attribute is *not* set, the endpoints of the scale will | ||||
be integer multiples of the step size. | ||||
*/ | ||||
Floating = 0x04, | ||||
//! Turn the scale upside down. | ||||
Inverted = 0x08 | ||||
}; | }; | |||
//! Layout attributes | ||||
typedef QFlags<Attribute> Attributes; | ||||
explicit QwtScaleEngine(); | explicit QwtScaleEngine(); | |||
virtual ~QwtScaleEngine(); | virtual ~QwtScaleEngine(); | |||
void setAttribute(Attribute, bool on = true); | void setAttribute( Attribute, bool on = true ); | |||
bool testAttribute(Attribute) const; | bool testAttribute( Attribute ) const; | |||
void setAttributes(int); | void setAttributes( Attributes ); | |||
int 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 ); | |||
double lowerMargin() const; | double lowerMargin() const; | |||
double upperMargin() const; | double upperMargin() const; | |||
/*! | /*! | |||
Align and divide an interval | Align and divide an interval | |||
\param maxNumSteps Max. number of steps | \param maxNumSteps Max. number of steps | |||
\param x1 First limit of the interval (In/Out) | \param x1 First limit of the interval (In/Out) | |||
\param x2 Second limit of the interval (In/Out) | \param x2 Second limit of the interval (In/Out) | |||
\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 maxMajSteps Maximum for the number of major steps | |||
\param maxMinSteps Maximum number of minor steps | \param maxMinSteps 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. | |||
*/ | */ | |||
virtual QwtScaleDiv divideScale(double x1, double x2, | virtual QwtScaleDiv divideScale( double x1, double x2, | |||
int maxMajSteps, int maxMinSteps, | int maxMajSteps, int maxMinSteps, | |||
double stepSize = 0.0) const = 0; | double stepSize = 0.0 ) const = 0; | |||
//! \return a transformation | //! \return a transformation | |||
virtual QwtScaleTransformation *transformation() const = 0; | virtual QwtScaleTransformation *transformation() const = 0; | |||
protected: | protected: | |||
bool contains(const QwtDoubleInterval &, double val) const; | bool contains( const QwtInterval &, double val ) const; | |||
QwtValueList strip(const QwtValueList&, const QwtDoubleInterval &) cons | QList<double> strip( const QList<double>&, const QwtInterval & ) const; | |||
t; | double divideInterval( double interval, int numSteps ) const; | |||
double divideInterval(double interval, int numSteps) const; | ||||
QwtDoubleInterval 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: | |||
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; | virtual QwtScaleTransformation *transformation() const; | |||
protected: | protected: | |||
QwtDoubleInterval align(const QwtDoubleInterval&, | QwtInterval align( const QwtInterval&, double stepSize ) const; | |||
double stepSize) const; | ||||
private: | ||||
void buildTicks( | void buildTicks( | |||
const QwtDoubleInterval &, double stepSize, int maxMinSteps, | const QwtInterval &, double stepSize, int maxMinSteps, | |||
QwtValueList ticks[QwtScaleDiv::NTickTypes]) const; | QList<double> ticks[QwtScaleDiv::NTickTypes] ) const; | |||
QList<double> buildMajorTicks( | ||||
const QwtInterval &interval, double stepSize ) const; | ||||
void buildMinorTicks( | void buildMinorTicks( | |||
const QwtValueList& majorTicks, | const QList<double>& majorTicks, | |||
int maxMinMark, double step, | int maxMinMark, double step, | |||
QwtValueList &, QwtValueList &) const; | QList<double> &, QList<double> & ) const; | |||
QwtValueList buildMajorTicks( | ||||
const QwtDoubleInterval &interval, double stepSize) const; | ||||
}; | }; | |||
/*! | /*! | |||
\brief A scale engine for logarithmic (base 10) scales | \brief A scale engine for logarithmic (base 10) 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 QwtLog10ScaleEngine: public QwtScaleEngine | |||
{ | { | |||
public: | public: | |||
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; | virtual QwtScaleTransformation *transformation() const; | |||
protected: | protected: | |||
QwtDoubleInterval log10(const QwtDoubleInterval&) const; | QwtInterval log10( const QwtInterval& ) const; | |||
QwtDoubleInterval pow10(const QwtDoubleInterval&) const; | QwtInterval pow10( const QwtInterval& ) const; | |||
private: | QwtInterval align( const QwtInterval&, double stepSize ) const; | |||
QwtDoubleInterval align(const QwtDoubleInterval&, | ||||
double stepSize) const; | ||||
void buildTicks( | void buildTicks( | |||
const QwtDoubleInterval &, double stepSize, int maxMinSteps, | const QwtInterval &, double stepSize, int maxMinSteps, | |||
QwtValueList ticks[QwtScaleDiv::NTickTypes]) const; | QList<double> ticks[QwtScaleDiv::NTickTypes] ) const; | |||
QwtValueList buildMinorTicks( | QList<double> buildMajorTicks( | |||
const QwtValueList& majorTicks, | const QwtInterval &interval, double stepSize ) const; | |||
int maxMinMark, double step) const; | ||||
QwtValueList buildMajorTicks( | QList<double> buildMinorTicks( | |||
const QwtDoubleInterval &interval, double stepSize) const; | const QList<double>& majorTicks, | |||
int maxMinMark, double step ) const; | ||||
}; | }; | |||
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtScaleEngine::Attributes ); | ||||
#endif | #endif | |||
End of changes. 33 change blocks. | ||||
72 lines changed or deleted | 72 lines changed or added | |||
qwt_scale_map.h | qwt_scale_map.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_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_math.h" | |||
#ifndef QT_NO_DEBUG_STREAM | ||||
#include <qdebug.h> | ||||
#endif | ||||
class QRectF; | ||||
/*! | /*! | |||
\brief Operations for linear or logarithmic (base 10) transformations | \brief Operations for linear or logarithmic (base 10) transformations | |||
*/ | */ | |||
class QWT_EXPORT QwtScaleTransformation | class QWT_EXPORT QwtScaleTransformation | |||
{ | { | |||
public: | public: | |||
//! Transformation type | ||||
enum Type | enum Type | |||
{ | { | |||
//! Transformation between 2 linear scales | ||||
Linear, | Linear, | |||
//! Transformation between a linear and a logarithmic ( base 10 ) s | ||||
cale | ||||
Log10, | Log10, | |||
//! Any other type of transformation | ||||
Other | Other | |||
}; | }; | |||
QwtScaleTransformation(Type type); | QwtScaleTransformation( Type type ); | |||
virtual ~QwtScaleTransformation(); | virtual ~QwtScaleTransformation(); | |||
virtual double xForm(double x, double s1, double s2, | virtual double xForm( double x, double s1, double s2, | |||
double p1, double p2) const; | double p1, double p2 ) const; | |||
virtual double invXForm(double x, double p1, double p2, | virtual double invXForm( double x, double s1, double s2, | |||
double s1, double s2) const; | double p1, double p2 ) const; | |||
Type type() const; | Type type() const; | |||
virtual QwtScaleTransformation *copy() const; | virtual QwtScaleTransformation *copy() const; | |||
private: | private: | |||
QwtScaleTransformation(); | QwtScaleTransformation(); | |||
QwtScaleTransformation &operator=( const QwtScaleTransformation); | QwtScaleTransformation &operator=( const QwtScaleTransformation ); | |||
const Type d_type; | const Type d_type; | |||
}; | }; | |||
//! \return Transformation type | //! \return Transformation type | |||
inline QwtScaleTransformation::Type QwtScaleTransformation::type() const | inline QwtScaleTransformation::Type QwtScaleTransformation::type() const | |||
{ | { | |||
return d_type; | return d_type; | |||
} | } | |||
/*! | /*! | |||
\brief A scale map | \brief A scale map | |||
QwtScaleMap offers transformations from a scale | QwtScaleMap offers transformations from a scale | |||
into a paint interval and vice versa. | into a paint interval 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( QwtScaleTransformation * ); | |||
const QwtScaleTransformation *transformation() const; | const QwtScaleTransformation *transformation() const; | |||
void setPaintInterval(int p1, int p2); | void setPaintInterval( double p1, double p2 ); | |||
void setPaintXInterval(double p1, double p2); | void setScaleInterval( double s1, double s2 ); | |||
void setScaleInterval(double s1, double s2); | ||||
int transform(double x) const; | ||||
double invTransform(double i) const; | ||||
double xTransform(double x) const; | double transform( double s ) 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 LogMin; | |||
QT_STATIC_CONST double LogMax; | QT_STATIC_CONST double LogMax; | |||
static QRectF transform( const QwtScaleMap &, | ||||
const QwtScaleMap &, const QRectF & ); | ||||
static QRectF invTransform( const QwtScaleMap &, | ||||
const QwtScaleMap &, const QRectF & ); | ||||
static QPointF transform( const QwtScaleMap &, | ||||
const QwtScaleMap &, const QPointF & ); | ||||
static QPointF invTransform( const QwtScaleMap &, | ||||
const QwtScaleMap &, const QPointF & ); | ||||
bool isInverting() const; | ||||
private: | private: | |||
void newFactor(); | void newFactor(); | |||
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 | |||
QwtScaleTransformation *d_transformation; | QwtScaleTransformation *d_transformation; | |||
}; | }; | |||
skipping to change at line 143 | skipping to change at line 162 | |||
inline double QwtScaleMap::p2() const | inline double QwtScaleMap::p2() const | |||
{ | { | |||
return d_p2; | return d_p2; | |||
} | } | |||
/*! | /*! | |||
\return qwtAbs(p2() - p1()) | \return qwtAbs(p2() - p1()) | |||
*/ | */ | |||
inline double QwtScaleMap::pDist() const | inline double QwtScaleMap::pDist() const | |||
{ | { | |||
return qwtAbs(d_p2 - d_p1); | return qAbs( d_p2 - d_p1 ); | |||
} | } | |||
/*! | /*! | |||
\return qwtAbs(s2() - s1()) | \return qwtAbs(s2() - s1()) | |||
*/ | */ | |||
inline double QwtScaleMap::sDist() const | inline double QwtScaleMap::sDist() const | |||
{ | { | |||
return qwtAbs(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 | |||
*/ | */ | |||
inline double QwtScaleMap::xTransform(double s) const | inline double QwtScaleMap::transform( double s ) const | |||
{ | { | |||
// try to inline code from QwtScaleTransformation | // try to inline code from QwtScaleTransformation | |||
if ( d_transformation->type() == QwtScaleTransformation::Linear ) | if ( d_transformation->type() == QwtScaleTransformation::Linear ) | |||
return d_p1 + (s - d_s1) * d_cnv; | return d_p1 + ( s - d_s1 ) * d_cnv; | |||
if ( d_transformation->type() == QwtScaleTransformation::Log10 ) | if ( d_transformation->type() == QwtScaleTransformation::Log10 ) | |||
return d_p1 + log(s / d_s1) * d_cnv; | return d_p1 + log( s / d_s1 ) * d_cnv; | |||
return d_transformation->xForm(s, d_s1, d_s2, d_p1, d_p2 ); | 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 | |||
\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 ); | return d_transformation->invXForm( p, d_p1, d_p2, d_s1, d_s2 ); | |||
} | } | |||
/*! | //! \return True, when ( p1() < p2() ) != ( s1() < s2() ) | |||
Transform a point related to the scale interval into an point | inline bool QwtScaleMap::isInverting() const | |||
related to the interval of the paint device and round it to | ||||
an integer. (In Qt <= 3.x paint devices are integer based. ) | ||||
\param s Value relative to the coordinates of the scale | ||||
\sa xTransform() | ||||
*/ | ||||
inline int QwtScaleMap::transform(double s) const | ||||
{ | { | |||
return qRound(xTransform(s)); | return ( ( d_p1 < d_p2 ) != ( d_s1 < d_s2 ) ); | |||
} | } | |||
#ifndef QT_NO_DEBUG_STREAM | ||||
QWT_EXPORT QDebug operator<<( QDebug, const QwtScaleMap & ); | ||||
#endif | ||||
#endif | #endif | |||
End of changes. 25 change blocks. | ||||
34 lines changed or deleted | 51 lines changed or added | |||
qwt_scale_widget.h | qwt_scale_widget.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_WIDGET_H | #ifndef QWT_SCALE_WIDGET_H | |||
#define QWT_SCALE_WIDGET_H | #define QWT_SCALE_WIDGET_H | |||
#include "qwt_global.h" | ||||
#include "qwt_text.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> | |||
#include "qwt_global.h" | ||||
#include "qwt_text.h" | ||||
#include "qwt_scale_draw.h" | ||||
class QPainter; | class QPainter; | |||
class QwtScaleTransformation; | class QwtScaleTransformation; | |||
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. | |||
*/ | */ | |||
class QWT_EXPORT QwtScaleWidget : public QWidget | class QWT_EXPORT QwtScaleWidget : public QWidget | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
public: | public: | |||
explicit QwtScaleWidget(QWidget *parent = NULL); | //! Layout flags of the title | |||
#if QT_VERSION < 0x040000 | enum LayoutFlag | |||
explicit QwtScaleWidget(QWidget *parent, const char *name); | { | |||
#endif | /*! | |||
explicit QwtScaleWidget(QwtScaleDraw::Alignment, QWidget *parent = NULL | The title of vertical scales is painted from top to bottom. | |||
); | Otherwise it is painted from bottom to top. | |||
*/ | ||||
TitleInverted = 1 | ||||
}; | ||||
//! Layout flags of the title | ||||
typedef QFlags<LayoutFlag> LayoutFlags; | ||||
explicit QwtScaleWidget( QWidget *parent = NULL ); | ||||
explicit QwtScaleWidget( QwtScaleDraw::Alignment, QWidget *parent = NUL | ||||
L ); | ||||
virtual ~QwtScaleWidget(); | virtual ~QwtScaleWidget(); | |||
signals: | Q_SIGNALS: | |||
//! Signal emitted, whenever the scale divison changes | //! Signal emitted, whenever the scale divison 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 setBorderDist(int start, int end); | void setLayoutFlag( LayoutFlag, bool on ); | |||
bool testLayoutFlag( LayoutFlag ) const; | ||||
void setBorderDist( int start, int end ); | ||||
int startBorderDist() const; | int startBorderDist() const; | |||
int endBorderDist() const; | int endBorderDist() const; | |||
void getBorderDistHint(int &start, int &end) const; | void getBorderDistHint( int &start, int &end ) const; | |||
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 setPenWidth(int); | void setScaleDiv( QwtScaleTransformation *, const QwtScaleDiv &sd ); | |||
int penWidth() const; | ||||
void setScaleDiv(QwtScaleTransformation *, const QwtScaleDiv &sd); | ||||
void setScaleDraw(QwtScaleDraw *); | void setScaleDraw( QwtScaleDraw * ); | |||
const QwtScaleDraw *scaleDraw() const; | const QwtScaleDraw *scaleDraw() const; | |||
QwtScaleDraw *scaleDraw(); | QwtScaleDraw *scaleDraw(); | |||
#if QT_VERSION < 0x040000 | void setLabelAlignment( Qt::Alignment ); | |||
void setLabelAlignment(int); | void setLabelRotation( double rotation ); | |||
#else | ||||
void setLabelAlignment(Qt::Alignment); | ||||
#endif | ||||
void setLabelRotation(double rotation); | ||||
void setColorBarEnabled(bool); | void setColorBarEnabled( bool ); | |||
bool isColorBarEnabled() const; | bool isColorBarEnabled() const; | |||
void setColorBarWidth(int); | void setColorBarWidth( int ); | |||
int colorBarWidth() const; | int colorBarWidth() const; | |||
void setColorMap(const QwtDoubleInterval &, const QwtColorMap &); | void setColorMap( const QwtInterval &, QwtColorMap * ); | |||
QwtDoubleInterval colorBarInterval() const; | QwtInterval colorBarInterval() const; | |||
const QwtColorMap &colorMap() const; | const QwtColorMap *colorMap() const; | |||
virtual QSize sizeHint() const; | virtual QSize sizeHint() const; | |||
virtual QSize minimumSizeHint() const; | virtual QSize minimumSizeHint() const; | |||
int titleHeightForWidth(int width) const; | int titleHeightForWidth( int width ) const; | |||
int dimForLength(int length, const QFont &scaleFont) const; | int dimForLength( int length, const QFont &scaleFont ) const; | |||
void drawColorBar(QPainter *painter, const QRect &rect) const; | void drawColorBar( QPainter *painter, const QRectF & ) const; | |||
void drawTitle(QPainter *painter, QwtScaleDraw::Alignment, | void drawTitle( QPainter *painter, QwtScaleDraw::Alignment, | |||
const QRect &rect) const; | const QRectF &rect ) const; | |||
void setAlignment(QwtScaleDraw::Alignment); | void setAlignment( QwtScaleDraw::Alignment ); | |||
QwtScaleDraw::Alignment alignment() const; | QwtScaleDraw::Alignment alignment() const; | |||
QRect colorBarRect(const QRect&) const; | QRectF colorBarRect( const QRectF& ) const; | |||
protected: | protected: | |||
virtual void paintEvent(QPaintEvent *e); | virtual void paintEvent( QPaintEvent * ); | |||
virtual void resizeEvent(QResizeEvent *e); | virtual void resizeEvent( QResizeEvent * ); | |||
#if QT_VERSION < 0x040000 | ||||
virtual void fontChange(const QFont &oldfont); | ||||
#endif | ||||
void draw(QPainter *p) const; | void draw( QPainter *p ) const; | |||
void scaleChange(); | void scaleChange(); | |||
void layoutScale( bool update = true ); | void layoutScale( bool update = true ); | |||
private: | private: | |||
void initScale(QwtScaleDraw::Alignment); | void initScale( QwtScaleDraw::Alignment ); | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtScaleWidget::LayoutFlags ); | ||||
#endif | #endif | |||
End of changes. 25 change blocks. | ||||
50 lines changed or deleted | 53 lines changed or added | |||
qwt_slider.h | qwt_slider.h | |||
---|---|---|---|---|
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | |||
* Qwt Widget Library | * Qwt Widget Library | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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 | |||
************************************************************************** ***/ | ************************************************************************** ***/ | |||
// vim: expandtab | ||||
#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_scale.h" | |||
#include "qwt_abstract_slider.h" | #include "qwt_abstract_slider.h" | |||
class QwtScaleDraw; | class QwtScaleDraw; | |||
/*! | /*! | |||
skipping to change at line 38 | skipping to change at line 36 | |||
\image html sliders.png | \image html sliders.png | |||
\sa QwtAbstractSlider and QwtAbstractScale for the descriptions | \sa QwtAbstractSlider and QwtAbstractScale for the descriptions | |||
of the inherited members. | of the inherited members. | |||
*/ | */ | |||
class QWT_EXPORT QwtSlider : public QwtAbstractSlider, public QwtAbstractSc ale | class QWT_EXPORT QwtSlider : public QwtAbstractSlider, public QwtAbstractSc ale | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
Q_ENUMS( ScalePos ) | Q_ENUMS( ScalePos ) | |||
Q_ENUMS( BGSTYLE ) | Q_ENUMS( BackgroundStyle ) | |||
Q_PROPERTY( ScalePos scalePosition READ scalePosition | Q_PROPERTY( ScalePos scalePosition READ scalePosition | |||
WRITE setScalePosition ) | WRITE setScalePosition ) | |||
Q_PROPERTY( BGSTYLE bgStyle READ bgStyle WRITE setBgStyle ) | Q_PROPERTY( BackgroundStyles backgroundStyle | |||
Q_PROPERTY( int thumbLength READ thumbLength WRITE setThumbLength ) | READ backgroundStyle WRITE setBackgroundStyle ) | |||
Q_PROPERTY( int thumbWidth READ thumbWidth WRITE setThumbWidth ) | 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 ) | ||||
public: | public: | |||
/*! | /*! | |||
Scale position. QwtSlider tries to enforce valid combinations of its | Scale position. QwtSlider tries to enforce valid combinations of its | |||
orientation and scale position: | orientation and scale position: | |||
- Qt::Horizonal combines with NoScale, TopScale and BottomScale | - Qt::Horizonal combines with NoScale, TopScale and BottomScale | |||
- Qt::Vertical combines with NoScale, LeftScale and RightScale | - Qt::Vertical combines with NoScale, LeftScale and RightScale | |||
\sa QwtSlider() | \sa QwtSlider() | |||
*/ | */ | |||
enum ScalePos | enum ScalePos | |||
{ | { | |||
//! The slider has no scale | ||||
NoScale, | NoScale, | |||
//! The scale is left of the slider | ||||
LeftScale, | LeftScale, | |||
//! The scale is right of the slider | ||||
RightScale, | RightScale, | |||
//! The scale is above of the slider | ||||
TopScale, | TopScale, | |||
//! The scale is below of the slider | ||||
BottomScale | BottomScale | |||
}; | }; | |||
/*! | /*! | |||
Background style. | Background style. | |||
\sa QwtSlider() | \sa QwtSlider() | |||
*/ | */ | |||
enum BGSTYLE | enum BackgroundStyle | |||
{ | { | |||
BgTrough = 0x1, | //! Trough background | |||
BgSlot = 0x2, | Trough = 0x01, | |||
BgBoth = BgTrough | BgSlot | ||||
//! Groove | ||||
Groove = 0x02, | ||||
}; | }; | |||
explicit QwtSlider(QWidget *parent, | //! Background styles | |||
Qt::Orientation = Qt::Horizontal, | typedef QFlags<BackgroundStyle> BackgroundStyles; | |||
ScalePos = NoScale, BGSTYLE bgStyle = BgTrough); | ||||
#if QT_VERSION < 0x040000 | explicit QwtSlider( QWidget *parent, | |||
explicit QwtSlider(QWidget *parent, const char *name); | Qt::Orientation = Qt::Horizontal, | |||
#endif | ScalePos = NoScale, BackgroundStyles = Trough ); | |||
virtual ~QwtSlider(); | virtual ~QwtSlider(); | |||
virtual void setOrientation(Qt::Orientation); | virtual void setOrientation( Qt::Orientation ); | |||
void setBgStyle(BGSTYLE); | void setBackgroundStyle( BackgroundStyles ); | |||
BGSTYLE bgStyle() const; | BackgroundStyles backgroundStyle() const; | |||
void setScalePosition(ScalePos s); | void setScalePosition( ScalePos s ); | |||
ScalePos scalePosition() const; | ScalePos scalePosition() const; | |||
int thumbLength() const; | void setHandleSize( int width, int height ); | |||
int thumbWidth() const; | void setHandleSize( const QSize & ); | |||
QSize handleSize() const; | ||||
void setBorderWidth( int bw ); | ||||
int borderWidth() const; | int borderWidth() const; | |||
void setThumbLength(int l); | void setSpacing( int ); | |||
void setThumbWidth(int w); | int spacing() const; | |||
void setBorderWidth(int bw); | ||||
void setMargins(int x, int y); | ||||
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; | |||
protected: | protected: | |||
virtual double getValue(const QPoint &p); | virtual double getValue( const QPoint &p ); | |||
virtual void getScrollMode(const QPoint &p, | virtual void getScrollMode( const QPoint &p, | |||
int &scrollMode, int &direction); | QwtAbstractSlider::ScrollMode &, int &direction ) const; | |||
void draw(QPainter *p, const QRect& update_rect); | virtual void drawSlider ( QPainter *, const QRect & ) const; | |||
virtual void drawSlider (QPainter *p, const QRect &r); | virtual void drawHandle( QPainter *, const QRect &, int pos ) const; | |||
virtual void drawThumb(QPainter *p, const QRect &, int pos); | ||||
virtual void resizeEvent( QResizeEvent * ); | ||||
virtual void resizeEvent(QResizeEvent *e); | virtual void paintEvent ( QPaintEvent * ); | |||
virtual void paintEvent (QPaintEvent *e); | virtual void changeEvent( QEvent * ); | |||
virtual void valueChange(); | virtual void valueChange(); | |||
virtual void rangeChange(); | virtual void rangeChange(); | |||
virtual void scaleChange(); | virtual void scaleChange(); | |||
virtual void fontChange(const QFont &oldFont); | ||||
void layoutSlider( bool update = true ); | int transform( double v ) const; | |||
int xyPosition(double v) const; | ||||
QwtScaleDraw *scaleDraw(); | QwtScaleDraw *scaleDraw(); | |||
private: | private: | |||
void initSlider(Qt::Orientation, ScalePos scalePos, BGSTYLE bgStyle); | void layoutSlider( bool ); | |||
void initSlider( Qt::Orientation, ScalePos, BackgroundStyles ); | ||||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtSlider::BackgroundStyles ); | ||||
#endif | #endif | |||
End of changes. 24 change blocks. | ||||
41 lines changed or deleted | 53 lines changed or added | |||
qwt_spline.h | qwt_spline.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_SPLINE_H | #ifndef QWT_SPLINE_H | |||
#define QWT_SPLINE_H | #define QWT_SPLINE_H | |||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include "qwt_double_rect.h" | #include <qpolygon.h> | |||
#include <qvector.h> | ||||
#if QT_VERSION >= 0x040000 | ||||
#include <QPolygonF> | ||||
#else | ||||
#include "qwt_array.h" | ||||
#endif | ||||
// MOC_SKIP_BEGIN | ||||
#if defined(QWT_TEMPLATEDLL) | ||||
#if QT_VERSION < 0x040000 | ||||
#ifndef QWTARRAY_TEMPLATE_QWTDOUBLEPOINT // by mjo3 | ||||
#define QWTARRAY_TEMPLATE_QWTDOUBLEPOINT | ||||
template class QWT_EXPORT QwtArray<QwtDoublePoint>; | ||||
#endif //end of QWTARRAY_TEMPLATE_QWTDOUBLEPOINT | ||||
#endif | ||||
#endif | ||||
// MOC_SKIP_END | ||||
/*! | /*! | |||
\brief A class for spline interpolation | \brief A class for spline interpolation | |||
The QwtSpline class is used for cubical spline interpolation. | The QwtSpline class is used for cubical spline interpolation. | |||
Two types of splines, natural and periodic, are supported. | Two types of splines, natural and periodic, are supported. | |||
\par Usage: | \par Usage: | |||
<ol> | <ol> | |||
<li>First call setPoints() to determine the spline coefficients | <li>First call setPoints() to determine the spline coefficients | |||
skipping to change at line 83 | skipping to change at line 63 | |||
} | } | |||
\endcode | \endcode | |||
*/ | */ | |||
class QWT_EXPORT QwtSpline | class QWT_EXPORT QwtSpline | |||
{ | { | |||
public: | public: | |||
//! Spline type | //! Spline type | |||
enum SplineType | enum SplineType | |||
{ | { | |||
//! A natural spline | ||||
Natural, | Natural, | |||
//! A periodic spline | ||||
Periodic | Periodic | |||
}; | }; | |||
QwtSpline(); | QwtSpline(); | |||
QwtSpline( const QwtSpline & ); | QwtSpline( const QwtSpline & ); | |||
~QwtSpline(); | ~QwtSpline(); | |||
QwtSpline &operator=( const QwtSpline & ); | QwtSpline &operator=( const QwtSpline & ); | |||
void setSplineType(SplineType); | void setSplineType( SplineType ); | |||
SplineType splineType() const; | SplineType splineType() const; | |||
#if QT_VERSION < 0x040000 | bool setPoints( const QPolygonF& points ); | |||
bool setPoints(const QwtArray<QwtDoublePoint>& points); | ||||
QwtArray<QwtDoublePoint> points() const; | ||||
#else | ||||
bool setPoints(const QPolygonF& points); | ||||
QPolygonF points() const; | QPolygonF points() const; | |||
#endif | ||||
void reset(); | void reset(); | |||
bool isValid() const; | bool isValid() const; | |||
double value(double x) const; | double value( double x ) const; | |||
const QwtArray<double> &coefficientsA() const; | const QVector<double> &coefficientsA() const; | |||
const QwtArray<double> &coefficientsB() const; | const QVector<double> &coefficientsB() const; | |||
const QwtArray<double> &coefficientsC() const; | const QVector<double> &coefficientsC() const; | |||
protected: | protected: | |||
bool buildNaturalSpline( const QPolygonF & ); | ||||
bool buildPeriodicSpline( const QPolygonF & ); | ||||
#if QT_VERSION < 0x040000 | private: | |||
bool buildNaturalSpline( | ||||
const QwtArray<QwtDoublePoint> &); | ||||
bool buildPeriodicSpline( | ||||
const QwtArray<QwtDoublePoint> &); | ||||
#else | ||||
bool buildNaturalSpline(const QPolygonF &); | ||||
bool buildPeriodicSpline(const QPolygonF &); | ||||
#endif | ||||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 10 change blocks. | ||||
43 lines changed or deleted | 14 lines changed or added | |||
qwt_symbol.h | qwt_symbol.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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 <qbrush.h> | ||||
#include <qpen.h> | ||||
#include <qsize.h> | ||||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include <QPolygonF> | ||||
class QPainter; | class QPainter; | |||
class QRect; | class QRect; | |||
class QSize; | ||||
class QBrush; | ||||
class QPen; | ||||
class QColor; | ||||
class QPointF; | ||||
//! A class for drawing symbols | //! A class for drawing symbols | |||
class QWT_EXPORT QwtSymbol | class QWT_EXPORT QwtSymbol | |||
{ | { | |||
public: | public: | |||
/*! | /*! | |||
Style | Symbol Style | |||
\sa setStyle(), style() | \sa setStyle(), style() | |||
*/ | */ | |||
enum Style | enum Style | |||
{ | { | |||
//! No Style. The symbol cannot be drawn. | ||||
NoSymbol = -1, | NoSymbol = -1, | |||
//! Ellipse or circle | ||||
Ellipse, | Ellipse, | |||
//! Rectangle | ||||
Rect, | Rect, | |||
//! Diamond | ||||
Diamond, | Diamond, | |||
//! Triangle pointing upwards | ||||
Triangle, | Triangle, | |||
//! Triangle pointing downwards | ||||
DTriangle, | DTriangle, | |||
//! Triangle pointing upwards | ||||
UTriangle, | UTriangle, | |||
//! Triangle pointing left | ||||
LTriangle, | LTriangle, | |||
//! Triangle pointing right | ||||
RTriangle, | RTriangle, | |||
//! Cross (+) | ||||
Cross, | Cross, | |||
//! Diagonal cross (X) | ||||
XCross, | XCross, | |||
//! Horizontal line | ||||
HLine, | HLine, | |||
//! Vertical line | ||||
VLine, | VLine, | |||
//! X combined with + | ||||
Star1, | Star1, | |||
//! Six-pointed star | ||||
Star2, | Star2, | |||
//! Hexagon | ||||
Hexagon, | Hexagon, | |||
StyleCnt | /*! | |||
Styles >= QwtSymbol::UserSymbol are reserved for derived | ||||
classes of QwtSymbol that overload drawSymbols() with | ||||
additional application specific symbol types. | ||||
*/ | ||||
UserStyle = 1000 | ||||
}; | }; | |||
public: | public: | |||
QwtSymbol(); | QwtSymbol( Style = NoSymbol ); | |||
QwtSymbol(Style st, const QBrush &bd, const QPen &pn, const QSize &s); | QwtSymbol( Style, const QBrush &, const QPen &, const QSize & ); | |||
QwtSymbol( const QwtSymbol & ); | ||||
virtual ~QwtSymbol(); | virtual ~QwtSymbol(); | |||
bool operator!=(const QwtSymbol &) const; | QwtSymbol &operator=( const QwtSymbol & ); | |||
virtual bool operator==(const QwtSymbol &) const; | bool operator==( const QwtSymbol & ) const; | |||
bool operator!=( const QwtSymbol & ) const; | ||||
virtual QwtSymbol *clone() const; | void setSize( const QSize & ); | |||
void setSize( int width, int height = -1 ); | ||||
const QSize& size() const; | ||||
void setSize(const QSize &s); | virtual void setColor( const QColor & ); | |||
void setSize(int a, int b = -1); | ||||
void setBrush(const QBrush& b); | void setBrush( const QBrush& b ); | |||
void setPen(const QPen &p); | const QBrush& brush() const; | |||
void setStyle (Style s); | ||||
void setPen( const QPen & ); | ||||
//! Return Brush | const QPen& pen() const; | |||
const QBrush& brush() const { return d_brush; } | ||||
//! Return Pen | void setStyle( Style ); | |||
const QPen& pen() const { return d_pen; } | Style style() const; | |||
//! Return Size | ||||
const QSize& size() const { return d_size; } | void drawSymbol( QPainter *, const QPointF & ) const; | |||
//! Return Style | void drawSymbols( QPainter *, const QPolygonF & ) const; | |||
Style style() const { return d_style; } | ||||
virtual QSize boundingSize() const; | ||||
void draw(QPainter *p, const QPoint &pt) const; | ||||
void draw(QPainter *p, int x, int y) const; | protected: | |||
virtual void draw(QPainter *p, const QRect &r) const; | virtual void drawSymbols( QPainter *, | |||
const QPointF *, int numPoints ) const; | ||||
private: | private: | |||
QBrush d_brush; | class PrivateData; | |||
QPen d_pen; | PrivateData *d_data; | |||
QSize d_size; | ||||
Style d_style; | ||||
}; | }; | |||
/*! | ||||
\brief Draw the symbol at a specified position | ||||
\param painter Painter | ||||
\param pos Position of the symbol in screen coordinates | ||||
*/ | ||||
inline void QwtSymbol::drawSymbol( | ||||
QPainter *painter, const QPointF &pos ) const | ||||
{ | ||||
drawSymbols( painter, &pos, 1 ); | ||||
} | ||||
/*! | ||||
\brief Draw symbols at the specified points | ||||
\param painter Painter | ||||
\param points Positions of the symbols in screen coordinates | ||||
*/ | ||||
inline void QwtSymbol::drawSymbols( | ||||
QPainter *painter, const QPolygonF &points ) const | ||||
{ | ||||
drawSymbols( painter, points.data(), points.size() ); | ||||
} | ||||
#endif | #endif | |||
End of changes. 27 change blocks. | ||||
33 lines changed or deleted | 99 lines changed or added | |||
qwt_text.h | qwt_text.h | |||
---|---|---|---|---|
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | |||
* Qwt Widget Library | * Qwt Widget Library | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* Copyright (C) 2003 Uwe Rathmann | * Copyright (C) 2003 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 | |||
************************************************************************** ***/ | ************************************************************************** ***/ | |||
// vim: expandtab | ||||
#ifndef QWT_TEXT_H | #ifndef QWT_TEXT_H | |||
#define QWT_TEXT_H | #define QWT_TEXT_H | |||
#include "qwt_global.h" | ||||
#include <qstring.h> | #include <qstring.h> | |||
#include <qsize.h> | #include <qsize.h> | |||
#include <qfont.h> | #include <qfont.h> | |||
#include "qwt_global.h" | ||||
class QColor; | class QColor; | |||
class QPen; | class QPen; | |||
class QBrush; | class QBrush; | |||
class QRect; | 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 | |||
skipping to change at line 61 | skipping to change at line 59 | |||
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. | |||
- AutoText\n | ||||
The text format is determined using QwtTextEngine::mightRender for | ||||
all available text engines in increasing order > PlainText. | ||||
If none of the text engines can render the text is rendered | ||||
like PlainText. | ||||
- PlainText\n | ||||
Draw the text as it is, using a QwtPlainTextEngine. | ||||
- RichText\n | ||||
Use the Scribe framework (Qt Rich Text) to render the text. | ||||
- MathMLText\n | ||||
Use a MathML (http://en.wikipedia.org/wiki/MathML) render engine | ||||
to display the text. The Qwt MathML extension offers such an engine | ||||
based on the MathML renderer of the Qt solutions package. Unfortuna | ||||
tely | ||||
it is only available for owners of a commercial Qt license. | ||||
- TeXText\n | ||||
Use a TeX (http://en.wikipedia.org/wiki/TeX) render engine | ||||
to display the text. | ||||
- OtherFormat\n | ||||
The number of text formats can be extended using setTextEngine. | ||||
Formats >= OtherFormat are not used by Qwt. | ||||
\sa QwtTextEngine, setTextEngine() | \sa QwtTextEngine, setTextEngine() | |||
*/ | */ | |||
enum TextFormat | enum TextFormat | |||
{ | { | |||
/*! | ||||
The text format is determined using QwtTextEngine::mightRender fo | ||||
r | ||||
all available text engines in increasing order > PlainText. | ||||
If none of the text engines can render the text is rendered | ||||
like QwtText::PlainText. | ||||
*/ | ||||
AutoText = 0, | AutoText = 0, | |||
//! Draw the text as it is, using a QwtPlainTextEngine. | ||||
PlainText, | PlainText, | |||
//! Use the Scribe framework (Qt Rich Text) to render the text. | ||||
RichText, | RichText, | |||
/*! | ||||
Use a MathML (http://en.wikipedia.org/wiki/MathML) render engine | ||||
to display the text. The Qwt MathML extension offers such an engi | ||||
ne | ||||
based on the MathML renderer of the Qt solutions package. | ||||
To enable MathML support the following code needs to be added to | ||||
the | ||||
application: | ||||
\verbatim QwtText::setTextEngine(QwtText::MathMLText, new QwtMathMLTextEngi | ||||
ne()); \endverbatim | ||||
*/ | ||||
MathMLText, | MathMLText, | |||
/*! | ||||
Use a TeX (http://en.wikipedia.org/wiki/TeX) render engine | ||||
to display the text ( not implemented yet ). | ||||
*/ | ||||
TeXText, | TeXText, | |||
/*! | ||||
The number of text formats can be extended using setTextEngine. | ||||
Formats >= QwtText::OtherFormat are not used by Qwt. | ||||
*/ | ||||
OtherFormat = 100 | OtherFormat = 100 | |||
}; | }; | |||
/*! | /*! | |||
\brief Paint Attributes | \brief Paint Attributes | |||
Font and color and background are optional attributes of a QwtText. | Font and color and background are optional attributes of a QwtText. | |||
The paint attributes hold the information, if they are set. | The paint attributes hold the information, if they are set. | |||
- PaintUsingTextFont\n | ||||
The text has an individual font. | ||||
- PaintUsingTextColor\n | ||||
The text has an individual color. | ||||
- PaintBackground\n | ||||
The text has an individual background. | ||||
*/ | */ | |||
enum PaintAttribute | enum PaintAttribute | |||
{ | { | |||
PaintUsingTextFont = 1, | //! The text has an individual font. | |||
PaintUsingTextColor = 2, | PaintUsingTextFont = 0x01, | |||
PaintBackground = 4 | ||||
//! The text has an individual color. | ||||
PaintUsingTextColor = 0x02, | ||||
//! The text has an individual background. | ||||
PaintBackground = 0x04 | ||||
}; | }; | |||
//! Paint attributes | ||||
typedef QFlags<PaintAttribute> PaintAttributes; | ||||
/*! | /*! | |||
\brief Layout Attributes | \brief Layout Attributes | |||
The layout attributes affects some aspects of the layout of the text. | The layout attributes affects some aspects of the layout of the text. | |||
- MinimumLayout\n | ||||
Layout the text without its margins. This mode is useful if a | ||||
text needs to be aligned accurately, like the tick labels of a scal | ||||
e. | ||||
If QwtTextEngine::textMargins is not implemented for the format | ||||
of the text, MinimumLayout has no effect. | ||||
*/ | */ | |||
enum LayoutAttribute | enum LayoutAttribute | |||
{ | { | |||
MinimumLayout = 1 | /*! | |||
Layout the text without its margins. This mode is useful if a | ||||
text needs to be aligned accurately, like the tick labels of a sc | ||||
ale. | ||||
If QwtTextEngine::textMargins is not implemented for the format | ||||
of the text, MinimumLayout has no effect. | ||||
*/ | ||||
MinimumLayout = 0x01 | ||||
}; | }; | |||
QwtText(const QString & = QString::null, | //! Layout attributes | |||
TextFormat textFormat = AutoText); | typedef QFlags<LayoutAttribute> LayoutAttributes; | |||
QwtText(const QwtText &); | ||||
QwtText( const QString & = QString::null, | ||||
TextFormat textFormat = AutoText ); | ||||
QwtText( const QwtText & ); | ||||
~QwtText(); | ~QwtText(); | |||
QwtText &operator=(const QwtText &); | QwtText &operator=( const QwtText & ); | |||
int operator==(const QwtText &) const; | bool operator==( const QwtText & ) const; | |||
int operator!=(const QwtText &) const; | bool operator!=( const QwtText & ) const; | |||
void setText(const QString &, | void setText( const QString &, | |||
QwtText::TextFormat textFormat = AutoText); | QwtText::TextFormat textFormat = AutoText ); | |||
QString text() const; | QString text() const; | |||
bool isNull() const; | bool isNull() const; | |||
bool isEmpty() const; | bool isEmpty() const; | |||
void setFont(const QFont &); | void setFont( const QFont & ); | |||
QFont font() const; | QFont font() const; | |||
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 setBackgroundPen( const QPen & ); | |||
QPen backgroundPen() const; | QPen backgroundPen() 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; | |||
int heightForWidth(int width, const QFont & = QFont()) const; | double heightForWidth( double width, const QFont & = QFont() ) const; | |||
QSize textSize(const QFont & = QFont()) const; | QSizeF textSize( const QFont & = QFont() ) const; | |||
void draw(QPainter *painter, const QRect &rect) const; | void draw( QPainter *painter, const QRectF &rect ) const; | |||
static const QwtTextEngine *textEngine(const QString &text, | static const QwtTextEngine *textEngine( | |||
QwtText::TextFormat = AutoText); | const QString &text, QwtText::TextFormat = AutoText ); | |||
static const QwtTextEngine *textEngine(QwtText::TextFormat); | static const QwtTextEngine *textEngine( QwtText::TextFormat ); | |||
static void setTextEngine(QwtText::TextFormat, QwtTextEngine *); | static void setTextEngine( QwtText::TextFormat, QwtTextEngine * ); | |||
private: | private: | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
class LayoutCache; | class LayoutCache; | |||
LayoutCache *d_layoutCache; | LayoutCache *d_layoutCache; | |||
}; | }; | |||
//! \return text().isNull() | //! \return text().isNull() | |||
skipping to change at line 207 | skipping to change at line 213 | |||
{ | { | |||
return text().isNull(); | return text().isNull(); | |||
} | } | |||
//! \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::LayoutAttributes ); | ||||
#endif | #endif | |||
End of changes. 35 change blocks. | ||||
71 lines changed or deleted | 83 lines changed or added | |||
qwt_text_engine.h | qwt_text_engine.h | |||
---|---|---|---|---|
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ************************* **** | |||
* Qwt Widget Library | * Qwt Widget Library | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* Copyright (C) 2003 Uwe Rathmann | * Copyright (C) 2003 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 | |||
************************************************************************** ***/ | ************************************************************************** ***/ | |||
// vim: expandtab | ||||
#ifndef QWT_TEXT_ENGINE_H | #ifndef QWT_TEXT_ENGINE_H | |||
#define QWT_TEXT_ENGINE_H 1 | #define QWT_TEXT_ENGINE_H 1 | |||
#include <qsize.h> | ||||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include <qsize.h> | ||||
class QFont; | class QFont; | |||
class QRect; | class QRectF; | |||
class QString; | class QString; | |||
class QPainter; | class QPainter; | |||
/*! | /*! | |||
\brief Abstract base class for rendering text strings | \brief Abstract base class for rendering text strings | |||
A text engine is responsible for rendering texts for a | A text engine is responsible for rendering texts for a | |||
specific text format. They are used by QwtText to render a text. | specific text format. They are used by QwtText to render a text. | |||
QwtPlainTextEngine and QwtRichTextEngine are part of the Qwt library. | QwtPlainTextEngine and QwtRichTextEngine are part of the Qwt library. | |||
The implementation of QwtMathMLTextEngine uses code from the | ||||
QwtMathMLTextEngine can be found in Qwt MathML extension, that | Qt solution package. Because of license implications it is built into | |||
needs the MathML renderer of the Qt solutions package. Unfortunately | a separate library. | |||
it is only available with a commercial Qt license. | ||||
\sa QwtText::setTextEngine() | \sa QwtText::setTextEngine() | |||
*/ | */ | |||
class QWT_EXPORT QwtTextEngine | class QWT_EXPORT QwtTextEngine | |||
{ | { | |||
public: | public: | |||
virtual ~QwtTextEngine(); | virtual ~QwtTextEngine(); | |||
/*! | /*! | |||
Find the height for a given width | Find the height for a given width | |||
\param font Font of the text | \param font Font of the text | |||
\param flags Bitwise OR of the flags used like in QPainter::drawText | \param flags Bitwise OR of the flags used like in QPainter::drawText | |||
\param text Text to be rendered | \param text Text to be rendered | |||
\param width Width | \param width Width | |||
\return Calculated height | \return Calculated height | |||
*/ | */ | |||
virtual int heightForWidth(const QFont &font, int flags, | virtual double heightForWidth( const QFont &font, int flags, | |||
const QString &text, int 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 Caluclated size | |||
*/ | */ | |||
virtual QSize 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 aligend 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, | |||
int &left, int &right, int &top, int &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 QRect &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(); | |||
}; | }; | |||
/*! | /*! | |||
\brief A text engine for plain texts | \brief A text engine for plain texts | |||
QwtPlainTextEngine renders texts using the basic Qt classes | QwtPlainTextEngine renders texts using the basic Qt classes | |||
QPainter and QFontMetrics. | QPainter and QFontMetrics. | |||
*/ | */ | |||
class QWT_EXPORT QwtPlainTextEngine: public QwtTextEngine | class QWT_EXPORT QwtPlainTextEngine: public QwtTextEngine | |||
{ | { | |||
public: | public: | |||
QwtPlainTextEngine(); | QwtPlainTextEngine(); | |||
virtual ~QwtPlainTextEngine(); | virtual ~QwtPlainTextEngine(); | |||
virtual int heightForWidth(const QFont &font, int flags, | virtual double heightForWidth( const QFont &font, int flags, | |||
const QString &text, int width) const; | const QString &text, double width ) const; | |||
virtual QSize textSize(const QFont &font, int flags, | virtual QSizeF textSize( const QFont &font, int flags, | |||
const QString &text) const; | const QString &text ) const; | |||
virtual void draw(QPainter *painter, const QRect &rect, | virtual void draw( QPainter *painter, const QRectF &rect, | |||
int flags, const QString &text) const; | int flags, const QString &text ) const; | |||
virtual bool mightRender(const QString &) const; | virtual bool mightRender( const QString & ) const; | |||
virtual void textMargins(const QFont &, const QString &, | virtual void textMargins( const QFont &, const QString &, | |||
int &left, int &right, int &top, int &bottom) const; | double &left, double &right, double &top, double &bottom ) const; | |||
private: | private: | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#ifndef QT_NO_RICHTEXT | #ifndef QT_NO_RICHTEXT | |||
/*! | /*! | |||
\brief A text engine for Qt rich texts | \brief A text engine for Qt rich texts | |||
QwtRichTextEngine renders Qt rich texts using the classes | QwtRichTextEngine renders Qt rich texts using the classes | |||
of the Scribe framework of Qt. | of the Scribe framework of Qt. | |||
*/ | */ | |||
class QWT_EXPORT QwtRichTextEngine: public QwtTextEngine | class QWT_EXPORT QwtRichTextEngine: public QwtTextEngine | |||
{ | { | |||
public: | public: | |||
QwtRichTextEngine(); | QwtRichTextEngine(); | |||
virtual int heightForWidth(const QFont &font, int flags, | virtual double heightForWidth( const QFont &font, int flags, | |||
const QString &text, int width) const; | const QString &text, double width ) const; | |||
virtual QSizeF textSize( const QFont &font, int flags, | ||||
const QString &text ) const; | ||||
virtual QSize textSize(const QFont &font, int flags, | virtual void draw( QPainter *painter, const QRectF &rect, | |||
const QString &text) const; | int flags, const QString &text ) const; | |||
virtual void draw(QPainter *painter, const QRect &rect, | virtual bool mightRender( const QString & ) const; | |||
int flags, const QString &text) const; | ||||
virtual bool mightRender(const QString &) const; | virtual void textMargins( const QFont &, const QString &, | |||
double &left, double &right, double &top, double &bottom ) const; | ||||
virtual void textMargins(const QFont &, const QString &, | ||||
int &left, int &right, int &top, int &bottom) const; | ||||
private: | private: | |||
QString taggedText(const QString &, int flags) const; | QString taggedText( const QString &, int flags ) const; | |||
}; | }; | |||
#endif // !QT_NO_RICHTEXT | #endif // !QT_NO_RICHTEXT | |||
#endif | #endif | |||
End of changes. 21 change blocks. | ||||
36 lines changed or deleted | 35 lines changed or added | |||
qwt_text_label.h | qwt_text_label.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_TEXT_LABEL_H | #ifndef QWT_TEXT_LABEL_H | |||
#define QWT_TEXT_LABEL_H | #define QWT_TEXT_LABEL_H | |||
#include <qframe.h> | ||||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include "qwt_text.h" | #include "qwt_text.h" | |||
#include <qframe.h> | ||||
class QString; | class QString; | |||
class QPaintEvent; | class QPaintEvent; | |||
class QPainter; | class QPainter; | |||
/*! | /*! | |||
\brief A Widget which displays a QwtText | \brief A Widget which displays a QwtText | |||
*/ | */ | |||
class QWT_EXPORT QwtTextLabel : public QFrame | class QWT_EXPORT QwtTextLabel : public QFrame | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
Q_PROPERTY( int indent READ indent WRITE setIndent ) | Q_PROPERTY( int indent READ indent WRITE setIndent ) | |||
Q_PROPERTY( int margin READ margin WRITE setMargin ) | Q_PROPERTY( int margin READ margin WRITE setMargin ) | |||
public: | public: | |||
explicit QwtTextLabel(QWidget *parent = NULL); | explicit QwtTextLabel( QWidget *parent = NULL ); | |||
#if QT_VERSION < 0x040000 | explicit QwtTextLabel( const QwtText &, QWidget *parent = NULL ); | |||
explicit QwtTextLabel(QWidget *parent, const char *name); | ||||
#endif | ||||
explicit QwtTextLabel(const QwtText &, QWidget *parent = NULL); | ||||
virtual ~QwtTextLabel(); | virtual ~QwtTextLabel(); | |||
public slots: | public Q_SLOTS: | |||
void setText(const QString &, | void setText( const QString &, | |||
QwtText::TextFormat textFormat = QwtText::AutoText); | QwtText::TextFormat textFormat = QwtText::AutoText ); | |||
virtual void setText(const QwtText &); | virtual void setText( const QwtText & ); | |||
void clear(); | void clear(); | |||
public: | public: | |||
const QwtText &text() const; | const QwtText &text() const; | |||
int indent() const; | int indent() const; | |||
void setIndent(int); | void setIndent( int ); | |||
int margin() const; | int margin() const; | |||
void setMargin(int); | void setMargin( int ); | |||
virtual QSize sizeHint() const; | virtual QSize sizeHint() const; | |||
virtual QSize minimumSizeHint() const; | virtual QSize minimumSizeHint() const; | |||
virtual int heightForWidth(int) const; | virtual int heightForWidth( int ) const; | |||
QRect textRect() const; | QRect textRect() const; | |||
protected: | protected: | |||
virtual void paintEvent(QPaintEvent *e); | virtual void paintEvent( QPaintEvent *e ); | |||
virtual void drawContents(QPainter *); | virtual void drawContents( QPainter * ); | |||
virtual void drawText(QPainter *, const QRect &); | virtual void drawText( QPainter *, const QRect & ); | |||
private: | private: | |||
void init(); | void init(); | |||
int defaultIndent() const; | int defaultIndent() const; | |||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
16 lines changed or deleted | 13 lines changed or added | |||
qwt_thermo.h | qwt_thermo.h | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
* Copyright (C) 1997 Josef Wilgen | * Copyright (C) 1997 Josef Wilgen | |||
* 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_THERMO_H | #ifndef QWT_THERMO_H | |||
#define QWT_THERMO_H | #define QWT_THERMO_H | |||
#include <qwidget.h> | ||||
#include <qcolor.h> | ||||
#include <qfont.h> | ||||
#include <qrect.h> | ||||
#include "qwt_global.h" | #include "qwt_global.h" | |||
#include "qwt_abstract_scale.h" | #include "qwt_abstract_scale.h" | |||
#include "qwt_interval.h" | ||||
#include <qwidget.h> | ||||
class QwtScaleDraw; | class QwtScaleDraw; | |||
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; | |||
- a scale; | - a scale; | |||
- an alarm level. | - an alarm level. | |||
\image html sysinfo.png | \image html sysinfo.png | |||
The fill colors might be calculated from an optional color map | ||||
If no color map has been assigned QwtThermo uses the | ||||
following colors/brushes from the widget palette: | ||||
- QPalette::Base | ||||
Background of the pipe | ||||
- QPalette::ButtonText | ||||
Fill brush below the alarm level | ||||
- QPalette::Highlight | ||||
Fill brush for the values above the alarm level | ||||
- QPalette::WindowText | ||||
For the axis of the scale | ||||
- QPalette::Text | ||||
For the labels of the scale | ||||
By default, the scale and range run over the same interval of values. | By default, the scale and range run over the same interval of values. | |||
QwtAbstractScale::setScale() changes the interval of the scale and allows | QwtAbstractScale::setScale() changes the interval of the scale and allows | |||
easy conversion between physical units. | easy conversion between physical units. | |||
The example shows how to make the scale indicate in degrees Fahrenheit an d | The example shows how to make the scale indicate in degrees Fahrenheit an d | |||
to set the value in degrees Kelvin: | to set the value in degrees Kelvin: | |||
\code | \code | |||
#include <qapplication.h> | #include <qapplication.h> | |||
#include <qwt_thermo.h> | #include <qwt_thermo.h> | |||
skipping to change at line 75 | skipping to change at line 89 | |||
\endcode | \endcode | |||
\todo Improve the support for a logarithmic range and/or scale. | \todo Improve the support for a logarithmic range and/or scale. | |||
*/ | */ | |||
class QWT_EXPORT QwtThermo: public QWidget, public QwtAbstractScale | class QWT_EXPORT QwtThermo: public QWidget, public QwtAbstractScale | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
Q_ENUMS( ScalePos ) | Q_ENUMS( ScalePos ) | |||
Q_PROPERTY( QBrush alarmBrush READ alarmBrush WRITE setAlarmBrush ) | ||||
Q_PROPERTY( QColor alarmColor READ alarmColor WRITE setAlarmColor ) | ||||
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( ScalePos scalePosition READ scalePosition | |||
WRITE setScalePosition ) | WRITE setScalePosition ) | |||
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( QBrush fillBrush READ fillBrush WRITE setFillBrush ) | ||||
Q_PROPERTY( QColor fillColor READ fillColor WRITE setFillColor ) | ||||
Q_PROPERTY( double maxValue READ maxValue WRITE setMaxValue ) | Q_PROPERTY( double maxValue READ maxValue WRITE setMaxValue ) | |||
Q_PROPERTY( double minValue READ minValue WRITE setMinValue ) | 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 | Scale position. QwtThermo tries to enforce valid combinations of its | |||
orientation and scale position: | orientation and scale position: | |||
- Qt::Horizonal combines with NoScale, TopScale and BottomScale | - Qt::Horizonal combines with NoScale, TopScale and BottomScale | |||
- Qt::Vertical combines with NoScale, LeftScale and RightScale | - Qt::Vertical combines with NoScale, LeftScale and RightScale | |||
\sa setOrientation(), setScalePosition() | \sa setOrientation(), setScalePosition() | |||
*/ | */ | |||
enum ScalePos | enum ScalePos | |||
{ | { | |||
//! No scale | ||||
NoScale, | NoScale, | |||
//! The scale is left of the pipe | ||||
LeftScale, | LeftScale, | |||
//! The scale is right of the pipe | ||||
RightScale, | RightScale, | |||
//! The scale is above the pipe | ||||
TopScale, | TopScale, | |||
//! The scale is below the pipe | ||||
BottomScale | BottomScale | |||
}; | }; | |||
explicit QwtThermo(QWidget *parent = NULL); | explicit QwtThermo( QWidget *parent = NULL ); | |||
#if QT_VERSION < 0x040000 | ||||
explicit QwtThermo(QWidget *parent, const char *name); | ||||
#endif | ||||
virtual ~QwtThermo(); | virtual ~QwtThermo(); | |||
void setOrientation(Qt::Orientation o, ScalePos s); | void setOrientation( Qt::Orientation, ScalePos ); | |||
void setScalePosition(ScalePos s); | void setScalePosition( ScalePos s ); | |||
ScalePos scalePosition() const; | ScalePos scalePosition() const; | |||
void setBorderWidth(int w); | void setSpacing( int ); | |||
int spacing() const; | ||||
void setBorderWidth( int w ); | ||||
int borderWidth() const; | int borderWidth() const; | |||
void setFillBrush(const QBrush &b); | void setFillBrush( const QBrush &b ); | |||
const QBrush &fillBrush() const; | const QBrush &fillBrush() const; | |||
void setFillColor(const QColor &c); | void setAlarmBrush( const QBrush &b ); | |||
const QColor &fillColor() const; | ||||
void setAlarmBrush(const QBrush &b); | ||||
const QBrush &alarmBrush() const; | const QBrush &alarmBrush() const; | |||
void setAlarmColor(const QColor &c); | void setAlarmLevel( double v ); | |||
const QColor &alarmColor() const; | ||||
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 setPipeWidth(int w); | void setColorMap( QwtColorMap * ); | |||
QwtColorMap *colorMap(); | ||||
const QwtColorMap *colorMap() const; | ||||
void setPipeWidth( int w ); | ||||
int pipeWidth() const; | int pipeWidth() const; | |||
void setMaxValue(double v); | void setRangeFlags( QwtInterval::BorderFlags ); | |||
QwtInterval::BorderFlags rangeFlags() const; | ||||
void setMaxValue( double v ); | ||||
double maxValue() const; | double maxValue() const; | |||
void setMinValue(double v); | void setMinValue( double v ); | |||
double minValue() const; | double minValue() const; | |||
double value() const; | double value() const; | |||
void setRange(double vmin, double vmax, bool lg = false); | void setRange( double vmin, double vmax, bool lg = false ); | |||
void setMargin(int m); | ||||
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 slots: | public Q_SLOTS: | |||
void setValue(double val); | virtual void setValue( double val ); | |||
protected: | protected: | |||
void draw(QPainter *p, const QRect& update_rect); | virtual void drawLiquid( QPainter *, const QRect & ) const; | |||
void drawThermo(QPainter *p); | ||||
void layoutThermo( bool update = true ); | ||||
virtual void scaleChange(); | virtual void scaleChange(); | |||
virtual void fontChange(const QFont &oldFont); | ||||
virtual void paintEvent(QPaintEvent *e); | virtual void paintEvent( QPaintEvent * ); | |||
virtual void resizeEvent(QResizeEvent *e); | virtual void resizeEvent( QResizeEvent * ); | |||
virtual void changeEvent( QEvent * ); | ||||
QwtScaleDraw *scaleDraw(); | QwtScaleDraw *scaleDraw(); | |||
QRect pipeRect() const; | ||||
private: | private: | |||
void initThermo(); | void layoutThermo( bool ); | |||
int transform(double v) const; | ||||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 33 change blocks. | ||||
42 lines changed or deleted | 62 lines changed or added | |||
qwt_wheel.h | qwt_wheel.h | |||
---|---|---|---|---|
skipping to change at line 28 | skipping to change at line 28 | |||
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 flywheel. | |||
\sa The radio example. | \sa The radio example. | |||
*/ | */ | |||
class QWT_EXPORT QwtWheel : public QwtAbstractSlider | class QWT_EXPORT QwtWheel : public QwtAbstractSlider | |||
{ | { | |||
Q_OBJECT | Q_OBJECT | |||
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 tickCnt READ tickCnt WRITE setTickCnt ) | |||
Q_PROPERTY( int internalBorder READ internalBorder WRITE setInternal | Q_PROPERTY( int wheelWidth READ wheelWidth WRITE setWheelWidth ) | |||
Border ) | Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth ) | |||
Q_PROPERTY( int wheelBorderWidth READ wheelBorderWidth WRITE setWheelBo | ||||
rderWidth ) | ||||
Q_PROPERTY( double mass READ mass WRITE setMass ) | Q_PROPERTY( double mass READ mass WRITE setMass ) | |||
public: | public: | |||
explicit QwtWheel(QWidget *parent = NULL); | explicit QwtWheel( QWidget *parent = NULL ); | |||
#if QT_VERSION < 0x040000 | ||||
explicit QwtWheel(QWidget *parent, const char *name); | ||||
#endif | ||||
virtual ~QwtWheel(); | virtual ~QwtWheel(); | |||
virtual void setOrientation(Qt::Orientation); | public Q_SLOTS: | |||
void setTotalAngle ( double ); | ||||
void setViewAngle( double ); | ||||
public: | ||||
virtual void setOrientation( Qt::Orientation ); | ||||
double totalAngle() const; | double totalAngle() const; | |||
double viewAngle() const; | double viewAngle() const; | |||
void setTickCnt( int ); | ||||
int tickCnt() const; | int tickCnt() const; | |||
int internalBorder() const; | ||||
void setMass( double ); | ||||
double mass() const; | double mass() const; | |||
void setTotalAngle (double angle); | void setWheelWidth( int ); | |||
void setTickCnt(int cnt); | int wheelWidth() const; | |||
void setViewAngle(double angle); | ||||
void setInternalBorder(int width); | void setWheelBorderWidth( int ); | |||
void setMass(double val); | int wheelBorderWidth() const; | |||
void setWheelWidth( int w ); | ||||
void setBorderWidth( int ); | ||||
int borderWidth() const; | ||||
QRect wheelRect() const; | ||||
virtual QSize sizeHint() const; | virtual QSize sizeHint() const; | |||
virtual QSize minimumSizeHint() const; | virtual QSize minimumSizeHint() const; | |||
protected: | protected: | |||
virtual void resizeEvent(QResizeEvent *e); | virtual void paintEvent( QPaintEvent * ); | |||
virtual void paintEvent(QPaintEvent *e); | virtual void resizeEvent( QResizeEvent * ); | |||
void layoutWheel( bool update = true ); | virtual void drawTicks( QPainter *, const QRectF & ); | |||
void draw(QPainter *, const QRect &); | virtual void drawWheelBackground( QPainter *, const QRectF & ); | |||
void drawWheel(QPainter *, const QRect &); | ||||
void drawWheelBackground(QPainter *, const QRect &); | ||||
void setColorArray(); | ||||
virtual void valueChange(); | virtual void valueChange(); | |||
virtual void paletteChange( const QPalette &); | ||||
virtual double getValue(const QPoint &); | virtual double getValue( const QPoint & ); | |||
virtual void getScrollMode(const QPoint &, | virtual void getScrollMode( const QPoint &, | |||
int &scrollMode, int &direction); | QwtAbstractSlider::ScrollMode &, int &direction ) const; | |||
private: | private: | |||
void initWheel(); | ||||
class PrivateData; | class PrivateData; | |||
PrivateData *d_data; | PrivateData *d_data; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 13 change blocks. | ||||
28 lines changed or deleted | 33 lines changed or added | |||