10 #include "qwt_plot_zoneitem.h"
11 #include "qwt_painter.h"
12 #include "qwt_scale_map.h"
14 #include "qwt_interval.h"
18 class QwtPlotZoneItem::PrivateData
25 QColor c( Qt::darkGray );
53 m_data =
new PrivateData;
88 setPen( QPen( color, width, style ) );
101 if ( m_data->pen !=
pen )
127 if ( m_data->brush !=
brush )
129 m_data->brush =
brush;
140 return m_data->brush;
167 return m_data->orientation;
211 return m_data->interval;
225 const QRectF& canvasRect )
const
227 if ( !m_data->interval.isValid() )
230 QPen
pen = m_data->pen;
231 pen.setCapStyle( Qt::FlatCap );
235 if ( m_data->orientation == Qt::Horizontal )
237 double y1 = yMap.
transform( m_data->interval.minValue() );
238 double y2 = yMap.
transform( m_data->interval.maxValue() );
246 QRectF r( canvasRect.left(), y1, canvasRect.width(), y2 - y1 );
249 if ( ( m_data->brush.style() != Qt::NoBrush ) && ( y1 != y2 ) )
254 if ( m_data->pen.style() != Qt::NoPen )
256 painter->setPen( m_data->pen );
264 double x1 = xMap.
transform( m_data->interval.minValue() );
265 double x2 = xMap.
transform( m_data->interval.maxValue() );
273 QRectF r( x1, canvasRect.top(), x2 - x1, canvasRect.height() );
276 if ( ( m_data->brush.style() != Qt::NoBrush ) && ( x1 != x2 ) )
281 if ( m_data->pen.style() != Qt::NoPen )
283 painter->setPen( m_data->pen );
305 if ( m_data->orientation == Qt::Horizontal )
A class representing an interval.
static void fillRect(QPainter *, const QRectF &, const QBrush &)
Wrapper for QPainter::fillRect()
static bool roundingAlignment()
static void drawLine(QPainter *, qreal x1, qreal y1, qreal x2, qreal y2)
Wrapper for QPainter::drawLine()
Base class for items on the plot canvas.
void setZ(double z)
Set the z value.
void setItemAttribute(ItemAttribute, bool on=true)
@ Rtti_PlotZone
For QwtPlotZoneItem.
virtual void itemChanged()
@ Legend
The item is represented on the legend.
virtual QRectF boundingRect() const
const QBrush & brush() const
void setOrientation(Qt::Orientation)
Set the orientation of the zone.
void setBrush(const QBrush &)
Assign a brush.
virtual QRectF boundingRect() const override
QwtInterval interval() const
virtual ~QwtPlotZoneItem()
Destructor.
void setPen(const QColor &, qreal width=0.0, Qt::PenStyle=Qt::SolidLine)
QwtPlotZoneItem()
Constructor.
void setInterval(double min, double max)
virtual int rtti() const override
Qt::Orientation orientation() const
virtual void draw(QPainter *, const QwtScaleMap &, const QwtScaleMap &, const QRectF &canvasRect) const override
double transform(double s) const
A class representing a text.