Qwt User's Guide 6.3.0
Loading...
Searching...
No Matches
qwt_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_SCALE_DRAW_H
11#define QWT_SCALE_DRAW_H
12
13#include "qwt_global.h"
14#include "qwt_abstract_scale_draw.h"
15
16#include <qpoint.h>
17
18class QTransform;
19class QSizeF;
20class QRectF;
21class QRect;
22
35class QWT_EXPORT QwtScaleDraw : public QwtAbstractScaleDraw
36{
37 public:
43 {
46
49
52
54 RightScale
55 };
56
58 virtual ~QwtScaleDraw();
59
60 void getBorderDistHint( const QFont&, int& start, int& end ) const;
61 int minLabelDist( const QFont& ) const;
62
63 int minLength( const QFont& ) const;
64 virtual double extent( const QFont& ) const QWT_OVERRIDE;
65
66 void move( double x, double y );
67 void move( const QPointF& );
68 void setLength( double length );
69
70 Alignment alignment() const;
71 void setAlignment( Alignment );
72
73 Qt::Orientation orientation() const;
74
75 QPointF pos() const;
76 double length() const;
77
78 void setLabelAlignment( Qt::Alignment );
79 Qt::Alignment labelAlignment() const;
80
81 void setLabelRotation( double rotation );
82 double labelRotation() const;
83
84 int maxLabelHeight( const QFont& ) const;
85 int maxLabelWidth( const QFont& ) const;
86
87 QPointF labelPosition( double value ) const;
88
89 QRectF labelRect( const QFont&, double value ) const;
90 QSizeF labelSize( const QFont&, double value ) const;
91
92 QRect boundingLabelRect( const QFont&, double value ) const;
93
94 protected:
95 QTransform labelTransformation( const QPointF&, const QSizeF& ) const;
96
97 virtual void drawTick( QPainter*,
98 double value, double len ) const QWT_OVERRIDE;
99
100 virtual void drawBackbone( QPainter* ) const QWT_OVERRIDE;
101 virtual void drawLabel( QPainter*, double value ) const QWT_OVERRIDE;
102
103 private:
104 void updateMap();
105
106 class PrivateData;
107 PrivateData* m_data;
108};
109
118inline void QwtScaleDraw::move( double x, double y )
119{
120 move( QPointF( x, y ) );
121}
122
123#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
A class for drawing scales.
void move(double x, double y)
@ BottomScale
The scale is below.
@ TopScale
The scale is above.
@ LeftScale
The scale is left.