Newer
Older
/* -*- 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
*****************************************************************************/
#include "qwt_math.h"
#include "qwt_clipper.h"
#include "qwt_painter.h"
#include "qwt_plot.h"
#include "qwt_curve_fitter.h"
#include "qwt_symbol.h"
#include "qwt_point_mapper.h"
#include <qpainter.h>
#include <qpixmap.h>
#include <qalgorithms.h>
#include <qmath.h>
if ( curve->symbol() &&
curve->testLegendAttribute( QwtPlotCurve::LegendShowSymbol ) )
{
QSize sz = curve->symbol()->boundingRect().size();
sz += QSize( 2, 2 ); // margin
if ( curve->testLegendAttribute( QwtPlotCurve::LegendShowLine ) )
{
// Avoid, that the line is completely covered by the symbol
i1 = qBound( 0, i1, size - 1 );
i2 = qBound( 0, i2, size - 1 );
}
class QwtPlotCurve::PrivateData
{
public:
PrivateData():
style( QwtPlotCurve::Lines ),
baseline( 0.0 ),
symbol( NULL ),
attributes( 0 ),
paintAttributes(
QwtPlotCurve::ClipPolygons | QwtPlotCurve::FilterPoints ),
legendAttributes( 0 )
{
pen = QPen( Qt::black );
delete symbol;
delete curveFitter;
}
QwtPlotCurve::CurveStyle style;
QwtCurveFitter *curveFitter;
QPen pen;
QBrush brush;
QwtPlotCurve::CurveAttributes attributes;
QwtPlotCurve::PaintAttributes paintAttributes;
QwtPlotCurve::QwtPlotCurve( const QwtText &title ):
QwtPlotSeriesItem( title )
QwtPlotCurve::QwtPlotCurve( const QString &title ):
QwtPlotSeriesItem( QwtText( title ) )
{
init();
}
//! Destructor
QwtPlotCurve::~QwtPlotCurve()
{
delete d_data;
}
setItemAttribute( QwtPlotItem::Legend );
setItemAttribute( QwtPlotItem::AutoScale );
}
//! \return QwtPlotItem::Rtti_PlotCurve
int QwtPlotCurve::rtti() const
{
return QwtPlotItem::Rtti_PlotCurve;
}
/*!
void QwtPlotCurve::setPaintAttribute( PaintAttribute attribute, bool on )
{
if ( on )
d_data->paintAttributes |= attribute;
else
d_data->paintAttributes &= ~attribute;
}
/*!
\return True, when attribute is enabled
\sa setPaintAttribute()
bool QwtPlotCurve::testPaintAttribute( PaintAttribute attribute ) const
Specify an attribute how to draw the legend icon
\param attribute Attribute
\param on On/Off
/sa testLegendAttribute(). legendIcon()
void QwtPlotCurve::setLegendAttribute( LegendAttribute attribute, bool on )
if ( on != testLegendAttribute( attribute ) )
{
if ( on )
d_data->legendAttributes |= attribute;
else
d_data->legendAttributes &= ~attribute;
qwtUpdateLegendIconSize( this );
legendChanged();
\return True, when attribute is enabled
\sa setLegendAttribute()
bool QwtPlotCurve::testLegendAttribute( LegendAttribute attribute ) const
Loading
Loading full blame...