Moved headers to separate include directories

This commit is contained in:
Wodann 2018-08-03 13:39:00 -04:00
commit 4c64008fa5
98 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,71 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_ABSTRACT_LEGEND_H
#define QWT_ABSTRACT_LEGEND_H
#include "qwt_global.h"
#include "qwt_legend_data.h"
#include <qframe.h>
#include <qlist.h>
class QVariant;
/*!
\brief Abstract base class for legend widgets
Legends, that need to be under control of the QwtPlot layout system
need to be derived from QwtAbstractLegend.
\note Other type of legends can be implemented by connecting to
the QwtPlot::legendDataChanged() signal. But as these legends
are unknown to the plot layout system the layout code
( on screen and for QwtPlotRenderer ) need to be organized
in application code.
\sa QwtLegend
*/
class QWT_EXPORT QwtAbstractLegend : public QFrame
{
Q_OBJECT
public:
explicit QwtAbstractLegend( QWidget *parent = NULL );
virtual ~QwtAbstractLegend();
/*!
Render the legend into a given rectangle.
\param painter Painter
\param rect Bounding rectangle
\param fillBackground When true, fill rect with the widget background
\sa renderLegend() is used by QwtPlotRenderer
*/
virtual void renderLegend( QPainter *painter,
const QRectF &rect, bool fillBackground ) const = 0;
//! \return True, when no plot item is inserted
virtual bool isEmpty() const = 0;
virtual int scrollExtent( Qt::Orientation ) const;
public Q_SLOTS:
/*!
\brief Update the entries for a plot item
\param itemInfo Info about an item
\param data List of legend entry attributes for the item
*/
virtual void updateLegend( const QVariant &itemInfo,
const QList<QwtLegendData> &data ) = 0;
};
#endif

View file

@ -0,0 +1,105 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_ABSTRACT_SCALE_H
#define QWT_ABSTRACT_SCALE_H
#include "qwt_global.h"
#include <qwidget.h>
class QwtScaleEngine;
class QwtAbstractScaleDraw;
class QwtScaleDiv;
class QwtScaleMap;
class QwtInterval;
/*!
\brief An abstract base class for widgets having a scale
The scale of an QwtAbstractScale is determined by a QwtScaleDiv
definition, that contains the boundaries and the ticks of the scale.
The scale is painted using a QwtScaleDraw object.
The scale division might be assigned explicitly - but usually
it is calculated from the boundaries using a QwtScaleEngine.
The scale engine also decides the type of transformation of the scale
( linear, logarithmic ... ).
*/
class QWT_EXPORT QwtAbstractScale: public QWidget
{
Q_OBJECT
Q_PROPERTY( double lowerBound READ lowerBound WRITE setLowerBound )
Q_PROPERTY( double upperBound READ upperBound WRITE setUpperBound )
Q_PROPERTY( int scaleMaxMajor READ scaleMaxMajor WRITE setScaleMaxMajor )
Q_PROPERTY( int scaleMaxMinor READ scaleMaxMinor WRITE setScaleMaxMinor )
Q_PROPERTY( double scaleStepSize READ scaleStepSize WRITE setScaleStepSize )
public:
QwtAbstractScale( QWidget *parent = NULL );
virtual ~QwtAbstractScale();
void setScale( double lowerBound, double upperBound );
void setScale( const QwtInterval & );
void setScale( const QwtScaleDiv & );
const QwtScaleDiv& scaleDiv() const;
void setLowerBound( double value );
double lowerBound() const;
void setUpperBound( double value );
double upperBound() const;
void setScaleStepSize( double stepSize );
double scaleStepSize() const;
void setScaleMaxMajor( int ticks );
int scaleMaxMinor() const;
void setScaleMaxMinor( int ticks );
int scaleMaxMajor() const;
void setScaleEngine( QwtScaleEngine * );
const QwtScaleEngine *scaleEngine() const;
QwtScaleEngine *scaleEngine();
int transform( double ) const;
double invTransform( int ) const;
bool isInverted() const;
double minimum() const;
double maximum() const;
const QwtScaleMap &scaleMap() const;
protected:
void rescale( double lowerBound,
double upperBound, double stepSize );
void setAbstractScaleDraw( QwtAbstractScaleDraw * );
const QwtAbstractScaleDraw *abstractScaleDraw() const;
QwtAbstractScaleDraw *abstractScaleDraw();
virtual void scaleChange();
private:
void updateScaleDraw();
class PrivateData;
PrivateData *d_data;
};
#endif

View file

@ -0,0 +1,141 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_ABSTRACT_SCALE_DRAW_H
#define QWT_ABSTRACT_SCALE_DRAW_H
#include "qwt_global.h"
#include "qwt_scale_div.h"
#include "qwt_text.h"
class QPalette;
class QPainter;
class QFont;
class QwtTransform;
class QwtScaleMap;
/*!
\brief A abstract base class for drawing scales
QwtAbstractScaleDraw can be used to draw linear or logarithmic scales.
After a scale division has been specified as a QwtScaleDiv object
using setScaleDiv(), the scale can be drawn with the draw() member.
*/
class QWT_EXPORT QwtAbstractScaleDraw
{
public:
/*!
Components of a scale
\sa enableComponent(), hasComponent
*/
enum ScaleComponent
{
//! Backbone = the line where the ticks are located
Backbone = 0x01,
//! Ticks
Ticks = 0x02,
//! Labels
Labels = 0x04
};
//! Scale components
typedef QFlags<ScaleComponent> ScaleComponents;
QwtAbstractScaleDraw();
virtual ~QwtAbstractScaleDraw();
void setScaleDiv( const QwtScaleDiv &s );
const QwtScaleDiv& scaleDiv() const;
void setTransformation( QwtTransform * );
const QwtScaleMap &scaleMap() const;
QwtScaleMap &scaleMap();
void enableComponent( ScaleComponent, bool enable = true );
bool hasComponent( ScaleComponent ) const;
void setTickLength( QwtScaleDiv::TickType, double length );
double tickLength( QwtScaleDiv::TickType ) const;
double maxTickLength() const;
void setSpacing( double margin );
double spacing() const;
void setPenWidth( int width );
int penWidth() const;
virtual void draw( QPainter *, const QPalette & ) const;
virtual QwtText label( double ) const;
/*!
Calculate the extent
The extent is the distance from the baseline to the outermost
pixel of the scale draw in opposite to its orientation.
It is at least minimumExtent() pixels.
\param font Font used for drawing the tick labels
\return Number of pixels
\sa setMinimumExtent(), minimumExtent()
*/
virtual double extent( const QFont &font ) const = 0;
void setMinimumExtent( double );
double minimumExtent() const;
protected:
/*!
Draw a tick
\param painter Painter
\param value Value of the tick
\param len Length of the tick
\sa drawBackbone(), drawLabel()
*/
virtual void drawTick( QPainter *painter, double value, double len ) const = 0;
/*!
Draws the baseline of the scale
\param painter Painter
\sa drawTick(), drawLabel()
*/
virtual void drawBackbone( QPainter *painter ) const = 0;
/*!
Draws the label for a major scale tick
\param painter Painter
\param value Value
\sa drawTick(), drawBackbone()
*/
virtual void drawLabel( QPainter *painter, double value ) const = 0;
void invalidateCache();
const QwtText &tickLabel( const QFont &, double value ) const;
private:
QwtAbstractScaleDraw( const QwtAbstractScaleDraw & );
QwtAbstractScaleDraw &operator=( const QwtAbstractScaleDraw & );
class PrivateData;
PrivateData *d_data;
};
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtAbstractScaleDraw::ScaleComponents )
#endif

View file

@ -0,0 +1,167 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_ABSTRACT_SLIDER_H
#define QWT_ABSTRACT_SLIDER_H
#include "qwt_global.h"
#include "qwt_abstract_scale.h"
/*!
\brief An abstract base class for slider widgets with a scale
A slider widget displays a value according to a scale.
The class is designed as a common super class for widgets like
QwtKnob, QwtDial and QwtSlider.
When the slider is nor readOnly() its value can be modified
by keyboard, mouse and wheel inputs.
The range of the slider is divided into a number of steps from
which the value increments according to user inputs depend.
Only for linear scales the number of steps correspond with
a fixed step size.
*/
class QWT_EXPORT QwtAbstractSlider: public QwtAbstractScale
{
Q_OBJECT
Q_PROPERTY( double value READ value WRITE setValue )
Q_PROPERTY( uint totalSteps READ totalSteps WRITE setTotalSteps )
Q_PROPERTY( uint singleSteps READ singleSteps WRITE setSingleSteps )
Q_PROPERTY( uint pageSteps READ pageSteps WRITE setPageSteps )
Q_PROPERTY( bool stepAlignment READ stepAlignment WRITE setStepAlignment )
Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
Q_PROPERTY( bool tracking READ isTracking WRITE setTracking )
Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping )
Q_PROPERTY( bool invertedControls READ invertedControls WRITE setInvertedControls )
public:
explicit QwtAbstractSlider( QWidget *parent = NULL );
virtual ~QwtAbstractSlider();
void setValid( bool );
bool isValid() const;
double value() const;
void setWrapping( bool );
bool wrapping() const;
void setTotalSteps( uint );
uint totalSteps() const;
void setSingleSteps( uint );
uint singleSteps() const;
void setPageSteps( uint );
uint pageSteps() const;
void setStepAlignment( bool );
bool stepAlignment() const;
void setTracking( bool );
bool isTracking() const;
void setReadOnly( bool );
bool isReadOnly() const;
void setInvertedControls( bool );
bool invertedControls() const;
public Q_SLOTS:
void setValue( double val );
Q_SIGNALS:
/*!
\brief Notify a change of value.
When tracking is enabled (default setting),
this signal will be emitted every time the value changes.
\param value New value
\sa setTracking(), sliderMoved()
*/
void valueChanged( double value );
/*!
This signal is emitted when the user presses the
movable part of the slider.
*/
void sliderPressed();
/*!
This signal is emitted when the user releases the
movable part of the slider.
*/
void sliderReleased();
/*!
This signal is emitted when the user moves the
slider with the mouse.
\param value New value
\sa valueChanged()
*/
void sliderMoved( double value );
protected:
virtual void mousePressEvent( QMouseEvent * );
virtual void mouseReleaseEvent( QMouseEvent * );
virtual void mouseMoveEvent( QMouseEvent * );
virtual void keyPressEvent( QKeyEvent * );
virtual void wheelEvent( QWheelEvent * );
/*!
\brief Determine what to do when the user presses a mouse button.
\param pos Mouse position
\retval True, when pos is a valid scroll position
\sa scrolledTo()
*/
virtual bool isScrollPosition( const QPoint &pos ) const = 0;
/*!
\brief Determine the value for a new position of the
movable part of the slider
\param pos Mouse position
\return Value for the mouse position
\sa isScrollPosition()
*/
virtual double scrolledTo( const QPoint &pos ) const = 0;
void incrementValue( int numSteps );
virtual void scaleChange();
protected:
virtual void sliderChange();
double incrementedValue(
double value, int stepCount ) const;
private:
double alignedValue( double ) const;
double boundedValue( double ) const;
class PrivateData;
PrivateData *d_data;
};
#endif

View file

@ -0,0 +1,93 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_ANALOG_CLOCK_H
#define QWT_ANALOG_CLOCK_H
#include "qwt_global.h"
#include "qwt_dial.h"
#include "qwt_dial_needle.h"
#include <qdatetime.h>
/*!
\brief An analog clock
\image html analogclock.png
\par Example
\code
#include <qwt_analog_clock.h>
QwtAnalogClock *clock = new QwtAnalogClock(...);
clock->scaleDraw()->setPenWidth(3);
clock->setLineWidth(6);
clock->setFrameShadow(QwtDial::Sunken);
clock->setTime();
// update the clock every second
QTimer *timer = new QTimer(clock);
timer->connect(timer, SIGNAL(timeout()), clock, SLOT(setCurrentTime()));
timer->start(1000);
\endcode
\note The examples/dials example shows how to use QwtAnalogClock.
*/
class QWT_EXPORT QwtAnalogClock: public QwtDial
{
Q_OBJECT
public:
/*!
Hand type
\sa setHand(), hand()
*/
enum Hand
{
//! Needle displaying the seconds
SecondHand,
//! Needle displaying the minutes
MinuteHand,
//! Needle displaying the hours
HourHand,
//! Number of needles
NHands
};
explicit QwtAnalogClock( QWidget* parent = NULL );
virtual ~QwtAnalogClock();
void setHand( Hand, QwtDialNeedle * );
const QwtDialNeedle *hand( Hand ) const;
QwtDialNeedle *hand( Hand );
public Q_SLOTS:
void setCurrentTime();
void setTime( const QTime & );
protected:
virtual void drawNeedle( QPainter *, const QPointF &,
double radius, double direction, QPalette::ColorGroup ) const;
virtual void drawHand( QPainter *, Hand, const QPointF &,
double radius, double direction, QPalette::ColorGroup ) const;
private:
// use setHand instead
void setNeedle( QwtDialNeedle * );
QwtDialNeedle *d_hand[NHands];
};
#endif

View file

@ -0,0 +1,52 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_ARROW_BUTTON_H
#define QWT_ARROW_BUTTON_H
#include "qwt_global.h"
#include <qpushbutton.h>
/*!
\brief Arrow Button
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
up, down, left or right.
*/
class QWT_EXPORT QwtArrowButton : public QPushButton
{
public:
explicit QwtArrowButton ( int num, Qt::ArrowType, QWidget *parent = NULL );
virtual ~QwtArrowButton();
Qt::ArrowType arrowType() const;
int num() const;
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
protected:
virtual void paintEvent( QPaintEvent *event );
virtual void drawButtonLabel( QPainter *p );
virtual void drawArrow( QPainter *,
const QRect &, Qt::ArrowType ) const;
virtual QRect labelRect() const;
virtual QSize arrowSize( Qt::ArrowType,
const QSize &boundingSize ) const;
virtual void keyPressEvent( QKeyEvent * );
private:
class PrivateData;
PrivateData *d_data;
};
#endif

40
include/qwt_clipper.h Normal file
View file

@ -0,0 +1,40 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_CLIPPER_H
#define QWT_CLIPPER_H
#include "qwt_global.h"
#include "qwt_interval.h"
#include <qpolygon.h>
#include <qvector.h>
class QRect;
class QRectF;
/*!
\brief Some clipping algorithms
*/
class QWT_EXPORT QwtClipper
{
public:
static QPolygon clipPolygon( const QRect &,
const QPolygon &, bool closePolygon = false );
static QPolygon clipPolygon( const QRectF &,
const QPolygon &, bool closePolygon = false );
static QPolygonF clipPolygonF( const QRectF &,
const QPolygonF &, bool closePolygon = false );
static QVector<QwtInterval> clipCircle(
const QRectF &, const QPointF &, double radius );
};
#endif

200
include/qwt_color_map.h Normal file
View file

@ -0,0 +1,200 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_COLOR_MAP_H
#define QWT_COLOR_MAP_H
#include "qwt_global.h"
#include "qwt_interval.h"
#include <qcolor.h>
#include <qvector.h>
/*!
\brief QwtColorMap is used to map values into colors.
For displaying 3D data on a 2D plane the 3rd dimension is often
displayed using colors, like f.e in a spectrogram.
Each color map is optimized to return colors for only one of the
following image formats:
- QImage::Format_Indexed8\n
- QImage::Format_ARGB32\n
\sa QwtPlotSpectrogram, QwtScaleWidget
*/
class QWT_EXPORT QwtColorMap
{
public:
/*!
Format for color mapping
\sa rgb(), colorIndex(), colorTable()
*/
enum Format
{
//! The map is intended to map into RGB values.
RGB,
/*!
The map is intended to map into 8 bit values, that
are indices into the color table.
*/
Indexed
};
QwtColorMap( Format = QwtColorMap::RGB );
virtual ~QwtColorMap();
Format format() const;
/*!
Map a value of a given interval into a RGB value.
\param interval Range for the values
\param value Value
\return RGB value, corresponding to value
*/
virtual QRgb rgb( const QwtInterval &interval,
double value ) const = 0;
/*!
Map a value of a given interval into a color index
\param interval Range for the values
\param value Value
\return color index, corresponding to value
*/
virtual unsigned char colorIndex(
const QwtInterval &interval, double value ) const = 0;
QColor color( const QwtInterval &, double value ) const;
virtual QVector<QRgb> colorTable( const QwtInterval & ) const;
private:
Format d_format;
};
/*!
\brief QwtLinearColorMap builds a color map from color stops.
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
into a color it is translated into this interval according to mode().
*/
class QWT_EXPORT QwtLinearColorMap: public QwtColorMap
{
public:
/*!
Mode of color map
\sa setMode(), mode()
*/
enum Mode
{
//! Return the color from the next lower color stop
FixedColors,
//! Interpolating the colors of the adjacent stops.
ScaledColors
};
QwtLinearColorMap( QwtColorMap::Format = QwtColorMap::RGB );
QwtLinearColorMap( const QColor &from, const QColor &to,
QwtColorMap::Format = QwtColorMap::RGB );
virtual ~QwtLinearColorMap();
void setMode( Mode );
Mode mode() const;
void setColorInterval( const QColor &color1, const QColor &color2 );
void addColorStop( double value, const QColor& );
QVector<double> colorStops() const;
QColor color1() const;
QColor color2() const;
virtual QRgb rgb( const QwtInterval &, double value ) const;
virtual unsigned char colorIndex(
const QwtInterval &, double value ) const;
class ColorStops;
private:
// Disabled copy constructor and operator=
QwtLinearColorMap( const QwtLinearColorMap & );
QwtLinearColorMap &operator=( const QwtLinearColorMap & );
class PrivateData;
PrivateData *d_data;
};
/*!
\brief QwtAlphaColorMap varies the alpha value of a color
*/
class QWT_EXPORT QwtAlphaColorMap: public QwtColorMap
{
public:
QwtAlphaColorMap( const QColor & = QColor( Qt::gray ) );
virtual ~QwtAlphaColorMap();
void setColor( const QColor & );
QColor color() const;
virtual QRgb rgb( const QwtInterval &, double value ) const;
private:
QwtAlphaColorMap( const QwtAlphaColorMap & );
QwtAlphaColorMap &operator=( const QwtAlphaColorMap & );
virtual unsigned char colorIndex(
const QwtInterval &, double value ) const;
class PrivateData;
PrivateData *d_data;
};
/*!
Map a value into a color
\param interval Valid interval for values
\param value Value
\return Color corresponding to value
\warning This method is slow for Indexed color maps. If it is
necessary to map many values, its better to get the
color table once and find the color using colorIndex().
*/
inline QColor QwtColorMap::color(
const QwtInterval &interval, double value ) const
{
if ( d_format == RGB )
{
return QColor::fromRgba( rgb( interval, value ) );
}
else
{
const unsigned int index = colorIndex( interval, value );
return colorTable( interval )[index]; // slow
}
}
/*!
\return Intended format of the color map
\sa Format
*/
inline QwtColorMap::Format QwtColorMap::format() const
{
return d_format;
}
#endif

161
include/qwt_column_symbol.h Normal file
View file

@ -0,0 +1,161 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_COLUMN_SYMBOL_H
#define QWT_COLUMN_SYMBOL_H
#include "qwt_global.h"
#include "qwt_interval.h"
#include <qpen.h>
#include <qsize.h>
#include <qrect.h>
class QPainter;
class QPalette;
class QRect;
class QwtText;
/*!
\brief Directed rectangle representing bounding rectangle and orientation
of a column.
*/
class QWT_EXPORT QwtColumnRect
{
public:
//! Direction of the column
enum Direction
{
//! From left to right
LeftToRight,
//! From right to left
RightToLeft,
//! From bottom to top
BottomToTop,
//! From top to bottom
TopToBottom
};
//! Build an rectangle with invalid intervals directed BottomToTop.
QwtColumnRect():
direction( BottomToTop )
{
}
//! \return A normalized QRect built from the intervals
QRectF toRect() const
{
QRectF r( hInterval.minValue(), vInterval.minValue(),
hInterval.maxValue() - hInterval.minValue(),
vInterval.maxValue() - vInterval.minValue() );
r = r.normalized();
if ( hInterval.borderFlags() & QwtInterval::ExcludeMinimum )
r.adjust( 1, 0, 0, 0 );
if ( hInterval.borderFlags() & QwtInterval::ExcludeMaximum )
r.adjust( 0, 0, -1, 0 );
if ( vInterval.borderFlags() & QwtInterval::ExcludeMinimum )
r.adjust( 0, 1, 0, 0 );
if ( vInterval.borderFlags() & QwtInterval::ExcludeMaximum )
r.adjust( 0, 0, 0, -1 );
return r;
}
//! \return Orientation
Qt::Orientation orientation() const
{
if ( direction == LeftToRight || direction == RightToLeft )
return Qt::Horizontal;
return Qt::Vertical;
}
//! Interval for the horizontal coordinates
QwtInterval hInterval;
//! Interval for the vertical coordinates
QwtInterval vInterval;
//! Direction
Direction direction;
};
//! A drawing primitive for columns
class QWT_EXPORT QwtColumnSymbol
{
public:
/*!
Style
\sa setStyle(), style()
*/
enum Style
{
//! No Style, the symbol draws nothing
NoStyle = -1,
/*!
The column is painted with a frame depending on the frameStyle()
and lineWidth() using the palette().
*/
Box,
/*!
Styles >= QwtColumnSymbol::UserStyle are reserved for derived
classes of QwtColumnSymbol that overload draw() with
additional application specific symbol types.
*/
UserStyle = 1000
};
/*!
Frame Style used in Box style().
\sa Style, setFrameStyle(), frameStyle(), setStyle(), setPalette()
*/
enum FrameStyle
{
//! No frame
NoFrame,
//! A plain frame style
Plain,
//! A raised frame style
Raised
};
public:
QwtColumnSymbol( Style = NoStyle );
virtual ~QwtColumnSymbol();
void setFrameStyle( FrameStyle style );
FrameStyle frameStyle() const;
void setLineWidth( int width );
int lineWidth() const;
void setPalette( const QPalette & );
const QPalette &palette() const;
void setStyle( Style );
Style style() const;
virtual void draw( QPainter *, const QwtColumnRect & ) const;
protected:
void drawBox( QPainter *, const QwtColumnRect & ) const;
private:
class PrivateData;
PrivateData* d_data;
};
#endif

83
include/qwt_compass.h Normal file
View file

@ -0,0 +1,83 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_COMPASS_H
#define QWT_COMPASS_H 1
#include "qwt_global.h"
#include "qwt_dial.h"
#include "qwt_round_scale_draw.h"
#include <qstring.h>
#include <qmap.h>
class QwtCompassRose;
/*!
\brief A special scale draw made for QwtCompass
QwtCompassScaleDraw maps values to strings using
a special map, that can be modified by the application
The default map consists of the labels N, NE, E, SE, S, SW, W, NW.
\sa QwtCompass
*/
class QWT_EXPORT QwtCompassScaleDraw: public QwtRoundScaleDraw
{
public:
explicit QwtCompassScaleDraw();
explicit QwtCompassScaleDraw( const QMap<double, QString> &map );
void setLabelMap( const QMap<double, QString> &map );
QMap<double, QString> labelMap() const;
virtual QwtText label( double value ) const;
private:
QMap<double, QString> d_labelMap;
};
/*!
\brief A Compass Widget
QwtCompass is a widget to display and enter directions. It consists
of a scale, an optional needle and rose.
\image html dials1.png
\note The examples/dials example shows how to use QwtCompass.
*/
class QWT_EXPORT QwtCompass: public QwtDial
{
Q_OBJECT
public:
explicit QwtCompass( QWidget* parent = NULL );
virtual ~QwtCompass();
void setRose( QwtCompassRose *rose );
const QwtCompassRose *rose() const;
QwtCompassRose *rose();
protected:
virtual void drawRose( QPainter *, const QPointF &center,
double radius, double north, QPalette::ColorGroup ) const;
virtual void drawScaleContents( QPainter *,
const QPointF &center, double radius ) const;
virtual void keyPressEvent( QKeyEvent * );
private:
class PrivateData;
PrivateData *d_data;
};
#endif

View file

@ -0,0 +1,89 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_COMPASS_ROSE_H
#define QWT_COMPASS_ROSE_H 1
#include "qwt_global.h"
#include <qpalette.h>
class QPainter;
/*!
\brief Abstract base class for a compass rose
*/
class QWT_EXPORT QwtCompassRose
{
public:
//! Destructor
virtual ~QwtCompassRose() {};
//! Assign a palette
virtual void setPalette( const QPalette &p )
{
d_palette = p;
}
//! \return Current palette
const QPalette &palette() const
{
return d_palette;
}
/*!
Draw the rose
\param painter Painter
\param center Center point
\param radius Radius of the rose
\param north Position
\param colorGroup Color group
*/
virtual void draw( QPainter *painter,
const QPointF &center, double radius, double north,
QPalette::ColorGroup colorGroup = QPalette::Active ) const = 0;
private:
QPalette d_palette;
};
/*!
\brief A simple rose for QwtCompass
*/
class QWT_EXPORT QwtSimpleCompassRose: public QwtCompassRose
{
public:
QwtSimpleCompassRose( int numThorns = 8, int numThornLevels = -1 );
virtual ~QwtSimpleCompassRose();
void setWidth( double w );
double width() const;
void setNumThorns( int count );
int numThorns() const;
void setNumThornLevels( int count );
int numThornLevels() const;
void setShrinkFactor( double factor );
double shrinkFactor() const;
virtual void draw( QPainter *, const QPointF &center, double radius,
double north, QPalette::ColorGroup = QPalette::Active ) const;
static void drawRose( QPainter *, const QPalette &,
const QPointF &center, double radius, double origin, double width,
int numThorns, int numThornLevels, double shrinkFactor );
private:
class PrivateData;
PrivateData *d_data;
};
#endif

161
include/qwt_counter.h Normal file
View file

@ -0,0 +1,161 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_COUNTER_H
#define QWT_COUNTER_H
#include "qwt_global.h"
#include <qwidget.h>
/*!
\brief The Counter Widget
A Counter consists of a label displaying a number and
one ore more (up to three) push buttons on each side
of the label which can be used to increment or decrement
the counter's value.
A counter has a range from a minimum value to a maximum value
and a step size. When the wrapping property is set
the counter is circular.
The number of steps by which a button increments or decrements the value
can be specified using setIncSteps(). The number of buttons can be
changed with setNumButtons().
Example:
\code
#include <qwt_counter.h>
QwtCounter *counter = new QwtCounter(parent);
counter->setRange(0.0, 100.0); // From 0.0 to 100
counter->setSingleStep( 1.0 ); // Step size 1.0
counter->setNumButtons(2); // Two buttons each side
counter->setIncSteps(QwtCounter::Button1, 1); // Button 1 increments 1 step
counter->setIncSteps(QwtCounter::Button2, 20); // Button 2 increments 20 steps
connect(counter, SIGNAL(valueChanged(double)), myClass, SLOT(newValue(double)));
\endcode
*/
class QWT_EXPORT QwtCounter : public QWidget
{
Q_OBJECT
Q_PROPERTY( double value READ value WRITE setValue )
Q_PROPERTY( double minimum READ minimum WRITE setMinimum )
Q_PROPERTY( double maximum READ maximum WRITE setMaximum )
Q_PROPERTY( double singleStep READ singleStep WRITE setSingleStep )
Q_PROPERTY( int numButtons READ numButtons WRITE setNumButtons )
Q_PROPERTY( int stepButton1 READ stepButton1 WRITE setStepButton1 )
Q_PROPERTY( int stepButton2 READ stepButton2 WRITE setStepButton2 )
Q_PROPERTY( int stepButton3 READ stepButton3 WRITE setStepButton3 )
Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping )
public:
//! Button index
enum Button
{
//! Button intended for minor steps
Button1,
//! Button intended for medium steps
Button2,
//! Button intended for large steps
Button3,
//! Number of buttons
ButtonCnt
};
explicit QwtCounter( QWidget *parent = NULL );
virtual ~QwtCounter();
void setValid( bool );
bool isValid() const;
void setWrapping( bool );
bool wrapping() const;
bool isReadOnly() const;
void setReadOnly( bool );
void setNumButtons( int n );
int numButtons() const;
void setIncSteps( QwtCounter::Button btn, int nSteps );
int incSteps( QwtCounter::Button btn ) const;
virtual QSize sizeHint() const;
double singleStep() const;
void setSingleStep( double s );
void setRange( double min, double max );
double minimum() const;
void setMinimum( double min );
double maximum() const;
void setMaximum( double max );
void setStepButton1( int nSteps );
int stepButton1() const;
void setStepButton2( int nSteps );
int stepButton2() const;
void setStepButton3( int nSteps );
int stepButton3() const;
double value() const;
public Q_SLOTS:
void setValue( double );
Q_SIGNALS:
/*!
This signal is emitted when a button has been released
\param value The new value
*/
void buttonReleased ( double value );
/*!
This signal is emitted when the counter's value has changed
\param value The new value
*/
void valueChanged ( double value );
protected:
virtual bool event( QEvent * );
virtual void wheelEvent( QWheelEvent * );
virtual void keyPressEvent( QKeyEvent * );
private Q_SLOTS:
void btnReleased();
void btnClicked();
void textChanged();
private:
void incrementValue( int numSteps );
void initCounter();
void updateButtons();
void showNumber( double );
class PrivateData;
PrivateData *d_data;
};
#endif

139
include/qwt_curve_fitter.h Normal file
View file

@ -0,0 +1,139 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_CURVE_FITTER_H
#define QWT_CURVE_FITTER_H
#include "qwt_global.h"
#include <qpolygon.h>
#include <qrect.h>
class QwtSpline;
/*!
\brief Abstract base class for a curve fitter
*/
class QWT_EXPORT QwtCurveFitter
{
public:
virtual ~QwtCurveFitter();
/*!
Find a curve which has the best fit to a series of data points
\param polygon Series of data points
\return Curve points
*/
virtual QPolygonF fitCurve( const QPolygonF &polygon ) const = 0;
protected:
QwtCurveFitter();
private:
QwtCurveFitter( const QwtCurveFitter & );
QwtCurveFitter &operator=( const QwtCurveFitter & );
};
/*!
\brief A curve fitter using cubic splines
*/
class QWT_EXPORT QwtSplineCurveFitter: public QwtCurveFitter
{
public:
/*!
Spline type
The default setting is Auto
\sa setFitMode(), 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,
//! Use a default spline algorithm
Spline,
//! Use a parametric spline algorithm
ParametricSpline
};
QwtSplineCurveFitter();
virtual ~QwtSplineCurveFitter();
void setFitMode( FitMode );
FitMode fitMode() const;
void setSpline( const QwtSpline& );
const QwtSpline &spline() const;
QwtSpline &spline();
void setSplineSize( int size );
int splineSize() const;
virtual QPolygonF fitCurve( const QPolygonF & ) const;
private:
QPolygonF fitSpline( const QPolygonF & ) const;
QPolygonF fitParametric( const QPolygonF & ) const;
class PrivateData;
PrivateData *d_data;
};
/*!
\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 runtime of the algorithm increases non linear ( worst case O( n*n ) )
and might be very slow for huge polygons. To avoid performance issues
it might be useful to split the polygon ( setChunkSize() ) and to run the algorithm
for these smaller parts. The disadvantage of having no interpolation
at the borders is for most use cases irrelevant.
The smoothed curve consists of a subset of the points that defined the
original curve.
In opposite to QwtSplineCurveFitter the Douglas and Peucker algorithm reduces
the number of points. By adjusting the tolerance parameter according to the
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;
void setChunkSize( uint );
uint chunkSize() const;
virtual QPolygonF fitCurve( const QPolygonF & ) const;
private:
virtual QPolygonF simplify( const QPolygonF & ) const;
class Line;
class PrivateData;
PrivateData *d_data;
};
#endif

128
include/qwt_date.h Normal file
View file

@ -0,0 +1,128 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef _QWT_DATE_H_
#define _QWT_DATE_H_
#include "qwt_global.h"
#include <qdatetime.h>
/*!
\brief A collection of methods around date/time values
Qt offers convenient classes for dealing with date/time values,
but Qwt uses coordinate systems that are based on doubles.
QwtDate offers methods to translate from QDateTime to double and v.v.
A double is interpreted as the number of milliseconds since
1970-01-01T00:00:00 Universal Coordinated Time - also known
as "The Epoch".
While the range of the Julian day in Qt4 is limited to [0, MAX_INT],
Qt5 stores it as qint64 offering a huge range of valid dates.
As the significance of a double is below this ( assuming a
fraction of 52 bits ) the translation is not
bijective with rounding errors for dates very far from Epoch.
For a resolution of 1 ms those start to happen for dates above the
year 144683.
An axis for a date/time interval is expected to be aligned
and divided in time/date units like seconds, minutes, ...
QwtDate offers several algorithms that are needed to
calculate these axes.
\sa QwtDateScaleEngine, QwtDateScaleDraw, QDate, QTime
*/
class QWT_EXPORT QwtDate
{
public:
/*!
How to identify the first week of year differs between
countries.
*/
enum Week0Type
{
/*!
According to ISO 8601 the first week of a year is defined
as "the week with the year's first Thursday in it".
FirstThursday corresponds to the numbering that is
implemented in QDate::weekNumber().
*/
FirstThursday,
/*!
"The week with January 1.1 in it."
In the U.S. this definition is more common than
FirstThursday.
*/
FirstDay
};
/*!
Classification of an time interval
Time intervals needs to be classified to decide how to
align and divide it.
*/
enum IntervalType
{
//! The interval is related to milliseconds
Millisecond,
//! The interval is related to seconds
Second,
//! The interval is related to minutes
Minute,
//! The interval is related to hours
Hour,
//! The interval is related to days
Day,
//! The interval is related to weeks
Week,
//! The interval is related to months
Month,
//! The interval is related to years
Year
};
enum
{
//! The Julian day of "The Epoch"
JulianDayForEpoch = 2440588
};
static QDate minDate();
static QDate maxDate();
static QDateTime toDateTime( double value,
Qt::TimeSpec = Qt::UTC );
static double toDouble( const QDateTime & );
static QDateTime ceil( const QDateTime &, IntervalType );
static QDateTime floor( const QDateTime &, IntervalType );
static QDate dateOfWeek0( int year, Week0Type );
static int weekNumber( const QDate &, Week0Type );
static int utcOffset( const QDateTime & );
static QString toString( const QDateTime &,
const QString & format, Week0Type );
};
#endif

View file

@ -0,0 +1,86 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef _QWT_DATE_SCALE_DRAW_H_
#define _QWT_DATE_SCALE_DRAW_H_ 1
#include "qwt_global.h"
#include "qwt_scale_draw.h"
#include "qwt_date.h"
/*!
\brief A class for drawing datetime scales
QwtDateScaleDraw displays values as datetime labels.
The format of the labels depends on the alignment of
the major tick labels.
The default format strings are:
- Millisecond\n
"hh:mm:ss:zzz\nddd dd MMM yyyy"
- Second\n
"hh:mm:ss\nddd dd MMM yyyy"
- Minute\n
"hh:mm\nddd dd MMM yyyy"
- Hour\n
"hh:mm\nddd dd MMM yyyy"
- Day\n
"ddd dd MMM yyyy"
- Week\n
"Www yyyy"
- Month\n
"MMM yyyy"
- Year\n
"yyyy"
The format strings can be modified using setDateFormat()
or individually for each tick label by overloading dateFormatOfDate(),
Usually QwtDateScaleDraw is used in combination with
QwtDateScaleEngine, that calculates scales for datetime
intervals.
\sa QwtDateScaleEngine, QwtPlot::setAxisScaleDraw()
*/
class QWT_EXPORT QwtDateScaleDraw: public QwtScaleDraw
{
public:
QwtDateScaleDraw( Qt::TimeSpec = Qt::LocalTime );
virtual ~QwtDateScaleDraw();
void setDateFormat( QwtDate::IntervalType, const QString & );
QString dateFormat( QwtDate::IntervalType ) const;
void setTimeSpec( Qt::TimeSpec );
Qt::TimeSpec timeSpec() const;
void setUtcOffset( int seconds );
int utcOffset() const;
void setWeek0Type( QwtDate::Week0Type );
QwtDate::Week0Type week0Type() const;
virtual QwtText label( double ) const;
QDateTime toDateTime( double ) const;
protected:
virtual QwtDate::IntervalType
intervalType( const QwtScaleDiv & ) const;
virtual QString dateFormatOfDate( const QDateTime &,
QwtDate::IntervalType ) const;
private:
class PrivateData;
PrivateData *d_data;
};
#endif

View file

@ -0,0 +1,86 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef _QWT_DATE_SCALE_ENGINE_H_
#define _QWT_DATE_SCALE_ENGINE_H_ 1
#include "qwt_date.h"
#include "qwt_scale_engine.h"
/*!
\brief A scale engine for date/time values
QwtDateScaleEngine builds scales from a time intervals.
Together with QwtDateScaleDraw it can be used for
axes according to date/time values.
Years, months, weeks, days, hours and minutes are organized
in steps with non constant intervals. QwtDateScaleEngine
classifies intervals and aligns the boundaries and tick positions
according to this classification.
QwtDateScaleEngine supports representations depending
on Qt::TimeSpec specifications. The valid range for scales
is limited by the range of QDateTime, that differs
between Qt4 and Qt5.
Datetime values are expected as the number of milliseconds since
1970-01-01T00:00:00 Universal Coordinated Time - also known
as "The Epoch", that can be converted to QDateTime using
QwtDate::toDateTime().
\sa QwtDate, QwtPlot::setAxisScaleEngine(),
QwtAbstractScale::setScaleEngine()
*/
class QWT_EXPORT QwtDateScaleEngine: public QwtLinearScaleEngine
{
public:
QwtDateScaleEngine( Qt::TimeSpec = Qt::LocalTime );
virtual ~QwtDateScaleEngine();
void setTimeSpec( Qt::TimeSpec );
Qt::TimeSpec timeSpec() const;
void setUtcOffset( int seconds );
int utcOffset() const;
void setWeek0Type( QwtDate::Week0Type );
QwtDate::Week0Type week0Type() const;
void setMaxWeeks( int );
int maxWeeks() const;
virtual void autoScale( int maxNumSteps,
double &x1, double &x2, double &stepSize ) const;
virtual QwtScaleDiv divideScale(
double x1, double x2,
int maxMajorSteps, int maxMinorSteps,
double stepSize = 0.0 ) const;
virtual QwtDate::IntervalType intervalType(
const QDateTime &, const QDateTime &, int maxSteps ) const;
QDateTime toDateTime( double ) const;
protected:
virtual QDateTime alignDate( const QDateTime &, double stepSize,
QwtDate::IntervalType, bool up ) const;
private:
QwtScaleDiv buildScaleDiv( const QDateTime &, const QDateTime &,
int maxMajorSteps, int maxMinorSteps,
QwtDate::IntervalType ) const;
private:
class PrivateData;
PrivateData *d_data;
};
#endif

168
include/qwt_dial.h Normal file
View file

@ -0,0 +1,168 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_DIAL_H
#define QWT_DIAL_H 1
#include "qwt_global.h"
#include "qwt_abstract_slider.h"
#include "qwt_abstract_scale_draw.h"
#include <qframe.h>
#include <qpalette.h>
class QwtDialNeedle;
class QwtRoundScaleDraw;
/*!
\brief QwtDial class provides a rounded range control.
QwtDial is intended as base class for dial widgets like
speedometers, compass widgets, clocks ...
\image html dials2.png
A dial contains a scale and a needle indicating the current value
of the dial. Depending on Mode one of them is fixed and the
other is rotating. If not isReadOnly() the
dial can be rotated by dragging the mouse or using keyboard inputs
(see QwtAbstractSlider::keyPressEvent()). A dial might be wrapping, what means
a rotation below/above one limit continues on the other limit (f.e compass).
The scale might cover any arc of the dial, its values are related to
the origin() of the dial.
Often dials have to be updated very often according to values from external
devices. For these high refresh rates QwtDial caches as much as possible.
For derived classes it might be necessary to clear these caches manually
according to attribute changes using invalidateCache().
\sa QwtCompass, QwtAnalogClock, QwtDialNeedle
\note The controls and dials examples shows different types of dials.
\note QDial is more similar to QwtKnob than to QwtDial
*/
class QWT_EXPORT QwtDial: public QwtAbstractSlider
{
Q_OBJECT
Q_ENUMS( Shadow Mode Direction )
Q_PROPERTY( int lineWidth READ lineWidth WRITE setLineWidth )
Q_PROPERTY( Shadow frameShadow READ frameShadow WRITE setFrameShadow )
Q_PROPERTY( Mode mode READ mode WRITE setMode )
Q_PROPERTY( double origin READ origin WRITE setOrigin )
Q_PROPERTY( double minScaleArc READ minScaleArc WRITE setMinScaleArc )
Q_PROPERTY( double maxScaleArc READ maxScaleArc WRITE setMaxScaleArc )
public:
/*!
\brief Frame shadow
Unfortunately it is not possible to use QFrame::Shadow
as a property of a widget that is not derived from QFrame.
The following enum is made for the designer only. It is safe
to use QFrame::Shadow instead.
*/
enum Shadow
{
//! QFrame::Plain
Plain = QFrame::Plain,
//! QFrame::Raised
Raised = QFrame::Raised,
//! QFrame::Sunken
Sunken = QFrame::Sunken
};
//! Mode controlling whether the needle or the scale is rotating
enum Mode
{
//! The needle is rotating
RotateNeedle,
//! The needle is fixed, the scales are rotating
RotateScale
};
explicit QwtDial( QWidget *parent = NULL );
virtual ~QwtDial();
void setFrameShadow( Shadow );
Shadow frameShadow() const;
void setLineWidth( int );
int lineWidth() const;
void setMode( Mode );
Mode mode() const;
void setScaleArc( double min, double max );
void setMinScaleArc( double min );
double minScaleArc() const;
void setMaxScaleArc( double min );
double maxScaleArc() const;
virtual void setOrigin( double );
double origin() const;
void setNeedle( QwtDialNeedle * );
const QwtDialNeedle *needle() const;
QwtDialNeedle *needle();
QRect boundingRect() const;
QRect innerRect() const;
virtual QRect scaleInnerRect() const;
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
void setScaleDraw( QwtRoundScaleDraw * );
QwtRoundScaleDraw *scaleDraw();
const QwtRoundScaleDraw *scaleDraw() const;
protected:
virtual void wheelEvent( QWheelEvent * );
virtual void paintEvent( QPaintEvent * );
virtual void changeEvent( QEvent * );
virtual void drawFrame( QPainter *p );
virtual void drawContents( QPainter * ) const;
virtual void drawFocusIndicator( QPainter * ) const;
void invalidateCache();
virtual void drawScale( QPainter *,
const QPointF &center, double radius ) const;
virtual void drawScaleContents( QPainter *painter,
const QPointF &center, double radius ) const;
virtual void drawNeedle( QPainter *, const QPointF &,
double radius, double direction, QPalette::ColorGroup ) const;
virtual double scrolledTo( const QPoint & ) const;
virtual bool isScrollPosition( const QPoint & ) const;
virtual void sliderChange();
virtual void scaleChange();
private:
void setAngleRange( double angle, double span );
void drawNeedle( QPainter * ) const;
class PrivateData;
PrivateData *d_data;
};
#endif

187
include/qwt_dial_needle.h Normal file
View file

@ -0,0 +1,187 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_DIAL_NEEDLE_H
#define QWT_DIAL_NEEDLE_H 1
#include "qwt_global.h"
#include <qpalette.h>
class QPainter;
class QPoint;
/*!
\brief Base class for needles that can be used in a QwtDial.
QwtDialNeedle is a pointer that indicates a value by pointing
to a specific direction.
\sa QwtDial, QwtCompass
*/
class QWT_EXPORT QwtDialNeedle
{
public:
QwtDialNeedle();
virtual ~QwtDialNeedle();
virtual void setPalette( const QPalette & );
const QPalette &palette() const;
virtual void draw( QPainter *painter, const QPointF &center,
double length, double direction,
QPalette::ColorGroup = QPalette::Active ) const;
protected:
/*!
\brief Draw the needle
The origin of the needle is at position (0.0, 0.0 )
pointing in direction 0.0 ( = east ).
The painter is already initialized with translation and
rotation.
\param painter Painter
\param length Length of the needle
\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:
QPalette d_palette;
};
/*!
\brief A needle for dial widgets
The following colors are used:
- QPalette::Mid\n
Pointer
- QPalette::Base\n
Knob
\sa QwtDial, QwtCompass
*/
class QWT_EXPORT QwtDialSimpleNeedle: public QwtDialNeedle
{
public:
//! Style of the needle
enum Style
{
//! Arrow
Arrow,
//! A straight line from the center
Ray
};
QwtDialSimpleNeedle( Style, bool hasKnob = true,
const QColor &mid = Qt::gray, const QColor &base = Qt::darkGray );
void setWidth( double width );
double width() const;
protected:
virtual void drawNeedle( QPainter *, double length,
QPalette::ColorGroup ) const;
private:
Style d_style;
bool d_hasKnob;
double d_width;
};
/*!
\brief A magnet needle for compass widgets
A magnet needle points to two opposite directions indicating
north and south.
The following colors are used:
- QPalette::Light\n
Used for pointing south
- QPalette::Dark\n
Used for pointing north
- QPalette::Base\n
Knob (ThinStyle only)
\sa QwtDial, QwtCompass
*/
class QWT_EXPORT QwtCompassMagnetNeedle: public QwtDialNeedle
{
public:
//! Style of the needle
enum Style
{
//! A needle with a triangular shape
TriangleStyle,
//! A thin needle
ThinStyle
};
QwtCompassMagnetNeedle( Style = TriangleStyle,
const QColor &light = Qt::white, const QColor &dark = Qt::red );
protected:
virtual void drawNeedle( QPainter *,
double length, QPalette::ColorGroup ) const;
private:
Style d_style;
};
/*!
\brief An indicator for the wind direction
QwtCompassWindArrow shows the direction where the wind comes from.
- QPalette::Light\n
Used for Style1, or the light half of Style2
- QPalette::Dark\n
Used for the dark half of Style2
\sa QwtDial, QwtCompass
*/
class QWT_EXPORT QwtCompassWindArrow: public QwtDialNeedle
{
public:
//! Style of the arrow
enum Style
{
//! A needle pointing to the center
Style1,
//! A needle pointing to the center
Style2
};
QwtCompassWindArrow( Style, const QColor &light = Qt::white,
const QColor &dark = Qt::gray );
protected:
virtual void drawNeedle( QPainter *,
double length, QPalette::ColorGroup ) const;
private:
Style d_style;
};
#endif

View file

@ -0,0 +1,83 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_DYNGRID_LAYOUT_H
#define QWT_DYNGRID_LAYOUT_H
#include "qwt_global.h"
#include <qlayout.h>
#include <qsize.h>
#include <qlist.h>
/*!
\brief The QwtDynGridLayout class lays out widgets in a grid,
adjusting the number of columns and rows to the current size.
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).
It lays out as many number of columns as possible (limited by maxColumns()).
*/
class QWT_EXPORT QwtDynGridLayout : public QLayout
{
Q_OBJECT
public:
explicit QwtDynGridLayout( QWidget *, int margin = 0, int space = -1 );
explicit QwtDynGridLayout( int space = -1 );
virtual ~QwtDynGridLayout();
virtual void invalidate();
void setMaxColumns( uint maxCols );
uint maxColumns() const;
uint numRows () const;
uint numColumns () const;
virtual void addItem( QLayoutItem * );
virtual QLayoutItem *itemAt( int index ) const;
virtual QLayoutItem *takeAt( int index );
virtual int count() const;
void setExpandingDirections( Qt::Orientations );
virtual Qt::Orientations expandingDirections() const;
QList<QRect> layoutItems( const QRect &, uint numCols ) const;
virtual int maxItemWidth() const;
virtual void setGeometry( const QRect &rect );
virtual bool hasHeightForWidth() const;
virtual int heightForWidth( int ) const;
virtual QSize sizeHint() const;
virtual bool isEmpty() const;
uint itemCount() const;
virtual uint columnsForWidth( int width ) const;
protected:
void layoutGrid( uint numCols,
QVector<int>& rowHeight, QVector<int>& colWidth ) const;
void stretchGrid( const QRect &rect, uint numCols,
QVector<int>& rowHeight, QVector<int>& colWidth ) const;
private:
void init();
int maxRowWidth( int numCols ) const;
class PrivateData;
PrivateData *d_data;
};
#endif

240
include/qwt_event_pattern.h Normal file
View file

@ -0,0 +1,240 @@
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_EVENT_PATTERN
#define QWT_EVENT_PATTERN 1
#include "qwt_global.h"
#include <qnamespace.h>
#include <qvector.h>
class QMouseEvent;
class QKeyEvent;
/*!
\brief A collection of event patterns
QwtEventPattern introduces an level of indirection for mouse and
keyboard inputs. Those are represented by symbolic names, so
the application code can be configured by individual mappings.
\sa QwtPicker, QwtPickerMachine, QwtPlotZoomer
*/
class QWT_EXPORT QwtEventPattern
{
public:
/*!
\brief Symbolic mouse input codes
QwtEventPattern implements 3 different settings for
mice with 1, 2, or 3 buttons that can be activated
using initMousePattern(). The default setting is for
3 button mice.
Individual settings can be configured using setMousePattern().
\sa initMousePattern(), setMousePattern(), setKeyPattern()
*/
enum MousePatternCode
{
/*!
The default setting for 1, 2 and 3 button mice is:
- Qt::LeftButton
- Qt::LeftButton
- Qt::LeftButton
*/
MouseSelect1,
/*!
The default setting for 1, 2 and 3 button mice is:
- Qt::LeftButton + Qt::ControlModifier
- Qt::RightButton
- Qt::RightButton
*/
MouseSelect2,
/*!
The default setting for 1, 2 and 3 button mice is:
- Qt::LeftButton + Qt::AltModifier
- Qt::LeftButton + Qt::AltModifier
- Qt::MidButton
*/
MouseSelect3,
/*!
The default setting for 1, 2 and 3 button mice is:
- Qt::LeftButton + Qt::ShiftModifier
- Qt::LeftButton + Qt::ShiftModifier
- Qt::LeftButton + Qt::ShiftModifier
*/
MouseSelect4,
/*!
The default setting for 1, 2 and 3 button mice is:
- Qt::LeftButton + Qt::ControlButton | Qt::ShiftModifier
- Qt::RightButton + Qt::ShiftModifier
- Qt::RightButton + Qt::ShiftModifier
*/
MouseSelect5,
/*!
The default setting for 1, 2 and 3 button mice is:
- Qt::LeftButton + Qt::AltModifier + Qt::ShiftModifier
- Qt::LeftButton + Qt::AltModifier | Qt::ShiftModifier
- Qt::MidButton + Qt::ShiftModifier
*/
MouseSelect6,
//! Number of mouse patterns
MousePatternCount
};
/*!
\brief Symbolic keyboard input codes
Individual settings can be configured using setKeyPattern()
\sa setKeyPattern(), setMousePattern()
*/
enum KeyPatternCode
{
//! Qt::Key_Return
KeySelect1,
//! Qt::Key_Space
KeySelect2,
//! Qt::Key_Escape
KeyAbort,
//! Qt::Key_Left
KeyLeft,
//! Qt::Key_Right
KeyRight,
//! Qt::Key_Up
KeyUp,
//! Qt::Key_Down
KeyDown,
//! Qt::Key_Plus
KeyRedo,
//! Qt::Key_Minus
KeyUndo,
//! Qt::Key_Escape
KeyHome,
//! Number of key patterns
KeyPatternCount
};
//! A pattern for mouse events
class MousePattern
{
public:
//! Constructor
MousePattern( Qt::MouseButton btn = Qt::NoButton,
Qt::KeyboardModifiers modifierCodes = Qt::NoModifier ):
button( btn ),
modifiers( modifierCodes )
{
}
//! Button
Qt::MouseButton button;
//! Keyboard modifier
Qt::KeyboardModifiers modifiers;
};
//! A pattern for key events
class KeyPattern
{
public:
//! Constructor
KeyPattern( int keyCode = Qt::Key_unknown,
Qt::KeyboardModifiers modifierCodes = Qt::NoModifier ):
key( keyCode ),
modifiers( modifierCodes )
{
}
//! Key code
int key;
//! Modifiers
Qt::KeyboardModifiers modifiers;
};
QwtEventPattern();
virtual ~QwtEventPattern();
void initMousePattern( int numButtons );
void initKeyPattern();
void setMousePattern( MousePatternCode, Qt::MouseButton button,
Qt::KeyboardModifiers = Qt::NoModifier );
void setKeyPattern( KeyPatternCode, int keyCode,
Qt::KeyboardModifiers modifierCodes = Qt::NoModifier );
void setMousePattern( const QVector<MousePattern> & );
void setKeyPattern( const QVector<KeyPattern> & );
const QVector<MousePattern> &mousePattern() const;
const QVector<KeyPattern> &keyPattern() const;
QVector<MousePattern> &mousePattern();
QVector<KeyPattern> &keyPattern();
bool mouseMatch( MousePatternCode, const QMouseEvent * ) const;
bool keyMatch( KeyPatternCode, const QKeyEvent * ) const;
protected:
virtual bool mouseMatch( const MousePattern &, const QMouseEvent * ) const;
virtual bool keyMatch( const KeyPattern &, const QKeyEvent * ) const;
private:
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable: 4251)
#endif
QVector<MousePattern> d_mousePattern;
QVector<KeyPattern> d_keyPattern;
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
};
//! Compare operator
inline bool operator==( QwtEventPattern::MousePattern b1,
QwtEventPattern::MousePattern b2 )
{
return b1.button == b2.button && b1.modifiers == b2.modifiers;
}
//! Compare operator
inline bool operator==( QwtEventPattern::KeyPattern b1,
QwtEventPattern::KeyPattern b2 )
{
return b1.key == b2.key && b1.modifiers == b2.modifiers;
}
#endif

Some files were not shown because too many files have changed in this diff Show more