All Classes Functions Variables Typedefs Enumerations Enumerator Pages
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 &canvasSize,
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