source: ntrip/trunk/BNC/qwt/qwt_scale_draw.h@ 10077

Last change on this file since 10077 was 9383, checked in by stoecker, 4 years ago

update to qwt verion 6.1.1 to fix build with newer Qt5

File size: 3.1 KB
Line 
1/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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#include <qpoint.h>
16#include <qrect.h>
17#include <qtransform.h>
18
19/*!
20 \brief A class for drawing scales
21
22 QwtScaleDraw can be used to draw linear or logarithmic scales.
23 A scale has a position, an alignment and a length, which can be specified .
24 The labels can be rotated and aligned
25 to the ticks using setLabelRotation() and setLabelAlignment().
26
27 After a scale division has been specified as a QwtScaleDiv object
28 using QwtAbstractScaleDraw::setScaleDiv(const QwtScaleDiv &s),
29 the scale can be drawn with the QwtAbstractScaleDraw::draw() member.
30*/
31class QWT_EXPORT QwtScaleDraw: public QwtAbstractScaleDraw
32{
33public:
34 /*!
35 Alignment of the scale draw
36 \sa setAlignment(), alignment()
37 */
38 enum Alignment
39 {
40 //! The scale is below
41 BottomScale,
42
43 //! The scale is above
44 TopScale,
45
46 //! The scale is left
47 LeftScale,
48
49 //! The scale is right
50 RightScale
51 };
52
53 QwtScaleDraw();
54 virtual ~QwtScaleDraw();
55
56 void getBorderDistHint( const QFont &, int &start, int &end ) const;
57 int minLabelDist( const QFont & ) const;
58
59 int minLength( const QFont & ) const;
60 virtual double extent( const QFont & ) const;
61
62 void move( double x, double y );
63 void move( const QPointF & );
64 void setLength( double length );
65
66 Alignment alignment() const;
67 void setAlignment( Alignment );
68
69 Qt::Orientation orientation() const;
70
71 QPointF pos() const;
72 double length() const;
73
74 void setLabelAlignment( Qt::Alignment );
75 Qt::Alignment labelAlignment() const;
76
77 void setLabelRotation( double rotation );
78 double labelRotation() const;
79
80 int maxLabelHeight( const QFont & ) const;
81 int maxLabelWidth( const QFont & ) const;
82
83 QPointF labelPosition( double value ) const;
84
85 QRectF labelRect( const QFont &, double value ) const;
86 QSizeF labelSize( const QFont &, double value ) const;
87
88 QRect boundingLabelRect( const QFont &, double value ) const;
89
90protected:
91 QTransform labelTransformation( const QPointF &, const QSizeF & ) const;
92
93 virtual void drawTick( QPainter *, double value, double len ) const;
94 virtual void drawBackbone( QPainter * ) const;
95 virtual void drawLabel( QPainter *, double value ) const;
96
97private:
98 QwtScaleDraw( const QwtScaleDraw & );
99 QwtScaleDraw &operator=( const QwtScaleDraw &other );
100
101 void updateMap();
102
103 class PrivateData;
104 PrivateData *d_data;
105};
106
107/*!
108 Move the position of the scale
109
110 \param x X coordinate
111 \param y Y coordinate
112
113 \sa move(const QPointF &)
114*/
115inline void QwtScaleDraw::move( double x, double y )
116{
117 move( QPointF( x, y ) );
118}
119
120#endif
Note: See TracBrowser for help on using the repository browser.