1
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
3
* Copyright (C) 1997 Josef Wilgen
4
* Copyright (C) 2002 Uwe Rathmann
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the Qwt License, Version 1.0
8
*****************************************************************************/
10
#ifndef QWT_PLOT_ITEM_H
11
#define QWT_PLOT_ITEM_H
13
#include "qwt_global.h"
14
#include "qwt_legend_itemmanager.h"
16
#include "qwt_double_rect.h"
28
\brief Base class for items on the plot canvas
31
class QWT_EXPORT QwtPlotItem: public QwtLegendItemManager
46
Rtti_PlotUserItem = 1000
55
#if QT_VERSION >= 0x040000
62
explicit QwtPlotItem(const QwtText &title = QwtText());
63
virtual ~QwtPlotItem();
65
void attach(QwtPlot *plot);
68
\brief This method detaches a QwtPlotItem from any QwtPlot it has been
71
detach() is equivalent to calling attach( NULL )
72
\sa attach( QwtPlot* plot )
74
void detach() { attach(NULL); }
76
QwtPlot *plot() const;
78
void setTitle(const QString &title);
79
void setTitle(const QwtText &title);
80
const QwtText &title() const;
82
virtual int rtti() const;
84
void setItemAttribute(ItemAttribute, bool on = true);
85
bool testItemAttribute(ItemAttribute) const;
87
#if QT_VERSION >= 0x040000
88
void setRenderHint(RenderHint, bool on = true);
89
bool testRenderHint(RenderHint) const;
97
virtual void setVisible(bool);
98
bool isVisible () const;
100
void setAxis(int xAxis, int yAxis);
102
void setXAxis(int axis);
105
void setYAxis(int axis);
108
virtual void itemChanged();
113
\param painter Painter
114
\param xMap Maps x-values into pixel coordinates.
115
\param yMap Maps y-values into pixel coordinates.
116
\param canvasRect Contents rect of the canvas in painter coordinates
118
virtual void draw(QPainter *painter,
119
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
120
const QRect &canvasRect) const = 0;
122
virtual QwtDoubleRect boundingRect() const;
124
virtual void updateLegend(QwtLegend *) const;
125
virtual void updateScaleDiv(const QwtScaleDiv&,
128
virtual QWidget *legendItem() const;
130
QwtDoubleRect scaleRect(const QwtScaleMap &, const QwtScaleMap &) const;
131
QRect paintRect(const QwtScaleMap &, const QwtScaleMap &) const;
133
QRect transform(const QwtScaleMap &, const QwtScaleMap &,
134
const QwtDoubleRect&) const;
135
QwtDoubleRect invTransform(const QwtScaleMap &, const QwtScaleMap &,
139
// Disabled copy constructor and operator=
140
QwtPlotItem( const QwtPlotItem & );
141
QwtPlotItem &operator=( const QwtPlotItem & );