source: ntrip/trunk/BNC/qwt/qwt_plot_seriesitem.cpp@ 8784

Last change on this file since 8784 was 8127, checked in by stoecker, 8 years ago

update qwt and qwtpolar, many QT5 fixes (unfinished)

File size: 2.5 KB
RevLine 
[4271]1/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
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 *****************************************************************************/
9
10#include "qwt_plot_seriesitem.h"
11
[8127]12class QwtPlotSeriesItem::PrivateData
[4271]13{
14public:
15 PrivateData():
16 orientation( Qt::Vertical )
17 {
18 }
19
20 Qt::Orientation orientation;
21};
22
23/*!
24 Constructor
25 \param title Title of the curve
26*/
[8127]27QwtPlotSeriesItem::QwtPlotSeriesItem( const QwtText &title ):
[4271]28 QwtPlotItem( title )
29{
30 d_data = new PrivateData();
[8127]31 setItemInterest( QwtPlotItem::ScaleInterest, true );
[4271]32}
33
34/*!
35 Constructor
36 \param title Title of the curve
37*/
[8127]38QwtPlotSeriesItem::QwtPlotSeriesItem( const QString &title ):
[4271]39 QwtPlotItem( QwtText( title ) )
40{
41 d_data = new PrivateData();
42}
43
44//! Destructor
[8127]45QwtPlotSeriesItem::~QwtPlotSeriesItem()
[4271]46{
47 delete d_data;
48}
49
50/*!
51 Set the orientation of the item.
52
53 The orientation() might be used in specific way by a plot item.
54 F.e. a QwtPlotCurve uses it to identify how to display the curve
55 int QwtPlotCurve::Steps or QwtPlotCurve::Sticks style.
56
57 \sa orientation()
58*/
[8127]59void QwtPlotSeriesItem::setOrientation( Qt::Orientation orientation )
[4271]60{
61 if ( d_data->orientation != orientation )
62 {
63 d_data->orientation = orientation;
[8127]64
65 legendChanged();
[4271]66 itemChanged();
67 }
68}
69
70/*!
71 \return Orientation of the plot item
72 \sa setOrientation()
73*/
[8127]74Qt::Orientation QwtPlotSeriesItem::orientation() const
[4271]75{
76 return d_data->orientation;
77}
78
79/*!
80 \brief Draw the complete series
81
82 \param painter Painter
83 \param xMap Maps x-values into pixel coordinates.
84 \param yMap Maps y-values into pixel coordinates.
[8127]85 \param canvasRect Contents rectangle of the canvas
[4271]86*/
[8127]87void QwtPlotSeriesItem::draw( QPainter *painter,
[4271]88 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
89 const QRectF &canvasRect ) const
90{
91 drawSeries( painter, xMap, yMap, canvasRect, 0, -1 );
92}
93
[8127]94QRectF QwtPlotSeriesItem::boundingRect() const
95{
96 return dataRect();
97}
98
99void QwtPlotSeriesItem::updateScaleDiv(
100 const QwtScaleDiv &xScaleDiv, const QwtScaleDiv &yScaleDiv )
101{
102 const QRectF rect = QRectF(
103 xScaleDiv.lowerBound(), yScaleDiv.lowerBound(),
104 xScaleDiv.range(), yScaleDiv.range() );
105
106 setRectOfInterest( rect );
107}
108
109void QwtPlotSeriesItem::dataChanged()
110{
111 itemChanged();
112}
Note: See TracBrowser for help on using the repository browser.