Qwt User's Guide: qwt_plot_seriesitem.cpp Source File

Qwt User's Guide 6.3.0

Loading...
Searching...
No Matches
qwt_plot_seriesitem.cpp
1/******************************************************************************
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#include "qwt_scale_div.h"
12#include "qwt_text.h"
13
14class QwtPlotSeriesItem::PrivateData
15{
16 public:
17 PrivateData()
18 : orientation( Qt::Vertical )
19 {
20 }
21
22 Qt::Orientation orientation;
23};
24
29 QwtPlotSeriesItem::QwtPlotSeriesItem( const QwtText& title )
30 : QwtPlotItem( title )
31{
32 m_data = new PrivateData();
33 setItemInterest( QwtPlotItem::ScaleInterest, true );
34}
35
40QwtPlotSeriesItem::QwtPlotSeriesItem( const QString& title )
41 : QwtPlotItem( QwtText( title ) )
42{
43 m_data = new PrivateData();
44 setItemInterest( QwtPlotItem::ScaleInterest, true );
45}
46
48QwtPlotSeriesItem::~QwtPlotSeriesItem()
49{
50 delete m_data;
51}
52
62 void QwtPlotSeriesItem::setOrientation( Qt::Orientation orientation )
63{
64 if ( m_data->orientation != orientation )
65 {
66 m_data->orientation = orientation;
67
68 legendChanged();
69 itemChanged();
70 }
71}
72
77Qt::Orientation QwtPlotSeriesItem::orientation() const
78{
79 return m_data->orientation;
80}
81
90 void QwtPlotSeriesItem::draw( QPainter* painter,
91 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
92 const QRectF& canvasRect ) const
93{
94 drawSeries( painter, xMap, yMap, canvasRect, 0, -1 );
95}
96
97QRectF QwtPlotSeriesItem::boundingRect() const
98{
99 return dataRect();
100}
101
102 void QwtPlotSeriesItem::updateScaleDiv(
103 const QwtScaleDiv& xScaleDiv, const QwtScaleDiv& yScaleDiv )
104{
105 const QRectF rect = QRectF(
106 xScaleDiv.lowerBound(), yScaleDiv.lowerBound(),
107 xScaleDiv.range(), yScaleDiv.range() );
108
109 setRectOfInterest( rect );
110}
111
112 void QwtPlotSeriesItem::dataChanged()
113{
114 itemChanged();
115}
QwtAbstractSeriesStore::dataRect
virtual QRectF dataRect() const =0
QwtAbstractSeriesStore::setRectOfInterest
virtual void setRectOfInterest(const QRectF &)=0
QwtPlotItem
Base class for items on the plot canvas.
Definition qwt_plot_item.h:67
QwtPlotItem::legendChanged
virtual void legendChanged()
Definition qwt_plot_item.cpp:491
QwtPlotItem::setItemInterest
void setItemInterest(ItemInterest, bool on=true)
Definition qwt_plot_item.cpp:279
QwtPlotItem::itemChanged
virtual void itemChanged()
Definition qwt_plot_item.cpp:481
QwtPlotItem::ScaleInterest
@ ScaleInterest
Definition qwt_plot_item.h:185
QwtPlotSeriesItem::orientation
Qt::Orientation orientation() const
Definition qwt_plot_seriesitem.cpp:77
QwtPlotSeriesItem::dataChanged
virtual void dataChanged() override
dataChanged() indicates, that the series has been changed.
Definition qwt_plot_seriesitem.cpp:112
QwtPlotSeriesItem::setOrientation
void setOrientation(Qt::Orientation)
Definition qwt_plot_seriesitem.cpp:62
QwtPlotSeriesItem::~QwtPlotSeriesItem
virtual ~QwtPlotSeriesItem()
Destructor.
Definition qwt_plot_seriesitem.cpp:48
QwtPlotSeriesItem::updateScaleDiv
virtual void updateScaleDiv(const QwtScaleDiv &, const QwtScaleDiv &) override
Update the item to changes of the axes scale division.
Definition qwt_plot_seriesitem.cpp:102
QwtPlotSeriesItem::draw
virtual void draw(QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const override
Draw the complete series.
Definition qwt_plot_seriesitem.cpp:90
QwtPlotSeriesItem::QwtPlotSeriesItem
QwtPlotSeriesItem(const QString &title=QString())
Definition qwt_plot_seriesitem.cpp:40
QwtPlotSeriesItem::boundingRect
virtual QRectF boundingRect() const override
Definition qwt_plot_seriesitem.cpp:97
QwtPlotSeriesItem::drawSeries
virtual void drawSeries(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const =0
QwtScaleDiv
A class representing a scale division.
Definition qwt_scale_div.h:34
QwtScaleDiv::lowerBound
double lowerBound() const
Definition qwt_scale_div.cpp:131
QwtScaleDiv::range
double range() const
Definition qwt_scale_div.cpp:159
QwtScaleMap
A scale map.
Definition qwt_scale_map.h:27
QwtText
A class representing a text.
Definition qwt_text.h:52