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


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:10