qwt_plot_item.h
/* -*- 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_PLOT_ITEM_H
#define QWT_PLOT_ITEM_H
#include "qwt_global.h"
#include "qwt_text.h"
#include "qwt_legend_data.h"
#include "qwt_graphic.h"
#include <qrect.h>
#include <qlist.h>
#include <qmetatype.h>
class QPainter;
class QwtScaleMap;
class QwtScaleDiv;
class QwtPlot;
class QWT_EXPORT QwtPlotItem
{
public:
enum RttiValues
{
Rtti_PlotItem = 0,
Rtti_PlotGrid,
Rtti_PlotScale,
Rtti_PlotLegend,
Rtti_PlotMarker,
Rtti_PlotCurve,
Rtti_PlotSpectroCurve,
Rtti_PlotIntervalCurve,
Rtti_PlotHistogram,
Rtti_PlotSpectrogram,
Rtti_PlotSVG,
Rtti_PlotTradingCurve,
Rtti_PlotBarChart,
Rtti_PlotMultiBarChart,
Rtti_PlotShape,
Rtti_PlotTextLabel,
Rtti_PlotZone,
Rtti_PlotUserItem = 1000
};
enum ItemAttribute
{
Legend = 0x01,
AutoScale = 0x02,
Margins = 0x04
};
typedef QFlags<ItemAttribute> ItemAttributes;
enum ItemInterest
{
ScaleInterest = 0x01,
LegendInterest = 0x02
};
typedef QFlags<ItemInterest> ItemInterests;
enum RenderHint
{
RenderAntialiased = 0x1
};
typedef QFlags<RenderHint> RenderHints;
explicit QwtPlotItem( const QwtText &title = QwtText() );
virtual ~QwtPlotItem();
void attach( QwtPlot *plot );
void detach();
QwtPlot *plot() const;
void setTitle( const QString &title );
void setTitle( const QwtText &title );
const QwtText &title() const;
virtual int rtti() const;
void setItemAttribute( ItemAttribute, bool on = true );
bool testItemAttribute( ItemAttribute ) const;
void setItemInterest( ItemInterest, bool on = true );
bool testItemInterest( ItemInterest ) const;
void setRenderHint( RenderHint, bool on = true );
bool testRenderHint( RenderHint ) const;
void setRenderThreadCount( uint numThreads );
uint renderThreadCount() const;
void setLegendIconSize( const QSize & );
QSize legendIconSize() const;
double z() const;
void setZ( double z );
void show();
void hide();
virtual void setVisible( bool );
bool isVisible () const;
void setAxes( int xAxis, int yAxis );
void setXAxis( int axis );
int xAxis() const;
void setYAxis( int axis );
int yAxis() const;
virtual void itemChanged();
virtual void legendChanged();
virtual void draw( QPainter *painter,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &canvasRect ) const = 0;
virtual QRectF boundingRect() const;
virtual void getCanvasMarginHint(
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &canvasRect,
double &left, double &top, double &right, double &bottom) const;
virtual void updateScaleDiv(
const QwtScaleDiv&, const QwtScaleDiv& );
virtual void updateLegend( const QwtPlotItem *,
const QList<QwtLegendData> & );
QRectF scaleRect( const QwtScaleMap &, const QwtScaleMap & ) const;
QRectF paintRect( const QwtScaleMap &, const QwtScaleMap & ) const;
virtual QList<QwtLegendData> legendData() const;
virtual QwtGraphic legendIcon( int index, const QSizeF & ) const;
protected:
QwtGraphic defaultIcon( const QBrush &, const QSizeF & ) const;
private:
// Disabled copy constructor and operator=
QwtPlotItem( const QwtPlotItem & );
QwtPlotItem &operator=( const QwtPlotItem & );
class PrivateData;
PrivateData *d_data;
};
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotItem::ItemAttributes )
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotItem::ItemInterests )
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotItem::RenderHints )
Q_DECLARE_METATYPE( QwtPlotItem * )
#endif
QwtPlotItem::ItemAttributes
QFlags< ItemAttribute > ItemAttributes
Plot Item Attributes.
Definition: qwt_plot_item.h:163
QwtPlotItem::Rtti_PlotZone
For QwtPlotZoneItem.
Definition: qwt_plot_item.h:124
QwtPlotItem
Base class for items on the plot canvas.
Definition: qwt_plot_item.h:64
QwtPlotItem::Rtti_PlotScale
For QwtPlotScaleItem.
Definition: qwt_plot_item.h:82
QwtText
A class representing a text.
Definition: qwt_text.h:51
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:30
QwtPlotItem::Rtti_PlotSVG
For QwtPlotSvgItem.
Definition: qwt_plot_item.h:106
QwtPlotItem::Rtti_PlotGrid
For QwtPlotGrid.
Definition: qwt_plot_item.h:79
QwtPlotItem::Rtti_PlotLegend
For QwtPlotLegendItem.
Definition: qwt_plot_item.h:85
QwtPlotItem::ItemInterests
QFlags< ItemInterest > ItemInterests
Plot Item Interests.
Definition: qwt_plot_item.h:197
QwtPlotItem::Rtti_PlotMultiBarChart
For QwtPlotMultiBarChart.
Definition: qwt_plot_item.h:115
QwtPlotItem::ItemInterest
ItemInterest
Plot Item Interests.
Definition: qwt_plot_item.h:175
QwtPlotItem::Rtti_PlotHistogram
For QwtPlotHistogram.
Definition: qwt_plot_item.h:100
QwtScaleDiv
A class representing a scale division.
Definition: qwt_scale_div.h:36
QwtPlotItem::ItemAttribute
ItemAttribute
Plot Item Attributes.
Definition: qwt_plot_item.h:142
QwtPlotItem::Rtti_PlotCurve
For QwtPlotCurve.
Definition: qwt_plot_item.h:91
QwtPlotItem::Rtti_PlotBarChart
For QwtPlotBarChart.
Definition: qwt_plot_item.h:112
QwtPlotItem::Rtti_PlotTextLabel
For QwtPlotTextLabel.
Definition: qwt_plot_item.h:121
QwtPlotItem::Rtti_PlotSpectroCurve
For QwtPlotSpectroCurve.
Definition: qwt_plot_item.h:94
QwtPlotItem::Rtti_PlotMarker
For QwtPlotMarker.
Definition: qwt_plot_item.h:88
QwtGraphic
A paint device for scalable graphics.
Definition: qwt_graphic.h:74
QwtPlotItem::RenderHint
RenderHint
Render hints.
Definition: qwt_plot_item.h:200
QwtPlotItem::Rtti_PlotTradingCurve
For QwtPlotTradingCurve.
Definition: qwt_plot_item.h:109
QwtPlotItem::RttiValues
RttiValues
Runtime type information.
Definition: qwt_plot_item.h:73
QwtPlot
A 2-D plotting widget.
Definition: qwt_plot.h:75
QwtPlotItem::Rtti_PlotShape
For QwtPlotShapeItem.
Definition: qwt_plot_item.h:118
QwtPlotItem::Rtti_PlotSpectrogram
For QwtPlotSpectrogram.
Definition: qwt_plot_item.h:103
QwtPlotItem::RenderHints
QFlags< RenderHint > RenderHints
Render hints.
Definition: qwt_plot_item.h:207
QwtPlotItem::Rtti_PlotIntervalCurve
For QwtPlotIntervalCurve.
Definition: qwt_plot_item.h:97