Qwt User's Guide 6.3.0
Loading...
Searching...
No Matches
qwt_abstract_scale_draw.h
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#ifndef QWT_ABSTRACT_SCALE_DRAW_H
11#define QWT_ABSTRACT_SCALE_DRAW_H
12
13#include "qwt_global.h"
14#include "qwt_scale_div.h"
15
16class QwtText;
17class QPalette;
18class QPainter;
19class QFont;
20class QwtTransform;
21class QwtScaleMap;
22
31class QWT_EXPORT QwtAbstractScaleDraw
32{
33 public:
34
40 {
42 Backbone = 0x01,
43
45 Ticks = 0x02,
46
48 Labels = 0x04
49 };
50
51 Q_DECLARE_FLAGS( ScaleComponents, ScaleComponent )
52
54 virtual ~QwtAbstractScaleDraw();
55
56 void setScaleDiv( const QwtScaleDiv& );
57 const QwtScaleDiv& scaleDiv() const;
58
59 void setTransformation( QwtTransform* );
60 const QwtScaleMap& scaleMap() const;
61 QwtScaleMap& scaleMap();
62
63 void enableComponent( ScaleComponent, bool enable = true );
64 bool hasComponent( ScaleComponent ) const;
65
66 void setTickLength( QwtScaleDiv::TickType, double length );
67 double tickLength( QwtScaleDiv::TickType ) const;
68 double maxTickLength() const;
69
70 void setSpacing( double );
71 double spacing() const;
72
73 void setPenWidthF( qreal width );
74 qreal penWidthF() const;
75
76 virtual void draw( QPainter*, const QPalette& ) const;
77
78 virtual QwtText label( double ) const;
79
92 virtual double extent( const QFont& font ) const = 0;
93
94 void setMinimumExtent( double );
95 double minimumExtent() const;
96
97 void invalidateCache();
98
99 protected:
109 virtual void drawTick( QPainter* painter, double value, double len ) const = 0;
110
117 virtual void drawBackbone( QPainter* painter ) const = 0;
118
127 virtual void drawLabel( QPainter* painter, double value ) const = 0;
128
129 const QwtText& tickLabel( const QFont&, double value ) const;
130
131 private:
132 Q_DISABLE_COPY(QwtAbstractScaleDraw)
133
134 class PrivateData;
135 PrivateData* m_data;
136};
137
138Q_DECLARE_OPERATORS_FOR_FLAGS( QwtAbstractScaleDraw::ScaleComponents )
139
140#endif
A abstract base class for drawing scales.
virtual void drawBackbone(QPainter *painter) const =0
virtual void drawTick(QPainter *painter, double value, double len) const =0
virtual double extent(const QFont &font) const =0
virtual void drawLabel(QPainter *painter, double value) const =0
QFlags< ScaleComponent > ScaleComponents
A class representing a scale division.
TickType
Scale tick types.
A scale map.
A class representing a text.
Definition qwt_text.h:52
A transformation between coordinate systems.