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
18 class QTransform;
19 class QSizeF;
20 class QRectF;
21 class QRect;
22
35 class QWT_EXPORT QwtScaleDraw : public QwtAbstractScaleDraw
36{
37 public:
42 enum Alignment
43 {
45 BottomScale,
46
48 TopScale,
49
51 LeftScale,
52
54 RightScale
55 };
56
57 QwtScaleDraw();
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
118 inline void QwtScaleDraw::move( double x, double y )
119{
120 move( QPointF( x, y ) );
121}
122
123#endif
QwtAbstractScaleDraw
A abstract base class for drawing scales.
Definition qwt_abstract_scale_draw.h:32
QwtAbstractScaleDraw::drawBackbone
virtual void drawBackbone(QPainter *painter) const =0
QwtAbstractScaleDraw::drawTick
virtual void drawTick(QPainter *painter, double value, double len) const =0
QwtAbstractScaleDraw::extent
virtual double extent(const QFont &font) const =0
QwtAbstractScaleDraw::drawLabel
virtual void drawLabel(QPainter *painter, double value) const =0
QwtScaleDraw
A class for drawing scales.
Definition qwt_scale_draw.h:36
QwtScaleDraw::move
void move(double x, double y)
Definition qwt_scale_draw.h:118
QwtScaleDraw::Alignment
Alignment
Definition qwt_scale_draw.h:43
QwtScaleDraw::BottomScale
@ BottomScale
The scale is below.
Definition qwt_scale_draw.h:45
QwtScaleDraw::TopScale
@ TopScale
The scale is above.
Definition qwt_scale_draw.h:48
QwtScaleDraw::LeftScale
@ LeftScale
The scale is left.
Definition qwt_scale_draw.h:51