Qwt User's Guide: qwt_scale_widget.h Source File

Qwt User's Guide 6.3.0

Loading...
Searching...
No Matches
qwt_scale_widget.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_WIDGET_H
11#define QWT_SCALE_WIDGET_H
12
13#include "qwt_global.h"
14#include "qwt_text.h"
15#include "qwt_scale_draw.h"
16
17#include <qwidget.h>
18#include <qfont.h>
19#include <qcolor.h>
20#include <qstring.h>
21
22class QPainter;
23class QwtTransform;
24class QwtScaleDiv;
25class QwtColorMap;
26
34 class QWT_EXPORT QwtScaleWidget : public QWidget
35{
36 Q_OBJECT
37
38 public:
40 enum LayoutFlag
41 {
46 TitleInverted = 1
47 };
48
49 Q_DECLARE_FLAGS( LayoutFlags, LayoutFlag )
50
51 explicit QwtScaleWidget( QWidget* parent = NULL );
52 explicit QwtScaleWidget( QwtScaleDraw::Alignment, QWidget* parent = NULL );
53 virtual ~QwtScaleWidget();
54
55 Q_SIGNALS:
57 void scaleDivChanged();
58
59 public:
60 void setTitle( const QString& title );
61 void setTitle( const QwtText& title );
62 QwtText title() const;
63
64 void setLayoutFlag( LayoutFlag, bool on );
65 bool testLayoutFlag( LayoutFlag ) const;
66
67 void setBorderDist( int dist1, int dist2 );
68 int startBorderDist() const;
69 int endBorderDist() const;
70
71 void getBorderDistHint( int& start, int& end ) const;
72
73 void getMinBorderDist( int& start, int& end ) const;
74 void setMinBorderDist( int start, int end );
75
76 void setMargin( int );
77 int margin() const;
78
79 void setSpacing( int );
80 int spacing() const;
81
82 void setScaleDiv( const QwtScaleDiv& );
83 void setTransformation( QwtTransform* );
84
85 void setScaleDraw( QwtScaleDraw* );
86 const QwtScaleDraw* scaleDraw() const;
87 QwtScaleDraw* scaleDraw();
88
89 void setLabelAlignment( Qt::Alignment );
90 void setLabelRotation( double rotation );
91
92 void setColorBarEnabled( bool );
93 bool isColorBarEnabled() const;
94
95 void setColorBarWidth( int );
96 int colorBarWidth() const;
97
98 void setColorMap( const QwtInterval&, QwtColorMap* );
99
100 QwtInterval colorBarInterval() const;
101 const QwtColorMap* colorMap() const;
102
103 virtual QSize sizeHint() const QWT_OVERRIDE;
104 virtual QSize minimumSizeHint() const QWT_OVERRIDE;
105
106 int titleHeightForWidth( int width ) const;
107 int dimForLength( int length, const QFont& scaleFont ) const;
108
109 void drawColorBar( QPainter*, const QRectF& ) const;
110 void drawTitle( QPainter*, QwtScaleDraw::Alignment,
111 const QRectF& rect ) const;
112
113 void setAlignment( QwtScaleDraw::Alignment );
114 QwtScaleDraw::Alignment alignment() const;
115
116 QRectF colorBarRect( const QRectF& ) const;
117
118 protected:
119 virtual void paintEvent( QPaintEvent* ) QWT_OVERRIDE;
120 virtual void resizeEvent( QResizeEvent* ) QWT_OVERRIDE;
121 virtual void changeEvent( QEvent* ) QWT_OVERRIDE;
122
123 void draw( QPainter* ) const;
124
125 void scaleChange();
126 void layoutScale( bool update_geometry = true );
127
128 private:
129 void initScale( QwtScaleDraw::Alignment );
130
131 class PrivateData;
132 PrivateData* m_data;
133};
134
135Q_DECLARE_OPERATORS_FOR_FLAGS( QwtScaleWidget::LayoutFlags )
136
137#endif
QwtColorMap
QwtColorMap is used to map values into colors.
Definition qwt_color_map.h:38
QwtInterval
A class representing an interval.
Definition qwt_interval.h:23
QwtScaleDiv
A class representing a scale division.
Definition qwt_scale_div.h:34
QwtScaleDraw
A class for drawing scales.
Definition qwt_scale_draw.h:36
QwtScaleDraw::Alignment
Alignment
Definition qwt_scale_draw.h:43
QwtScaleWidget
A Widget which contains a scale.
Definition qwt_scale_widget.h:35
QwtScaleWidget::LayoutFlags
QFlags< LayoutFlag > LayoutFlags
Definition qwt_scale_widget.h:49
QwtScaleWidget::scaleDivChanged
void scaleDivChanged()
Signal emitted, whenever the scale division changes.
QwtScaleWidget::LayoutFlag
LayoutFlag
Layout flags of the title.
Definition qwt_scale_widget.h:41
QwtText
A class representing a text.
Definition qwt_text.h:52
QwtTransform
A transformation between coordinate systems.
Definition qwt_transform.h:36