Qwt User's Guide  5.2.3
qwt_compass.h
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_COMPASS_H
11 #define QWT_COMPASS_H 1
12 
13 #include <qstring.h>
14 #include <qmap.h>
15 #include "qwt_dial.h"
16 
17 #if defined(QWT_TEMPLATEDLL)
18 
19 #if defined(QT_NO_STL) || QT_VERSION < 0x040000 || QT_VERSION > 0x040001
20 /*
21  Unfortunately Qt 4.0.0/Qt 4.0.1 contains uncompilable
22  code in the STL adaptors of qmap.h. The declaration below
23  instantiates this code resulting in compiler errors.
24  If you really need the map to be exported, remove the condition above
25  and fix the qmap.h
26 */
27 // MOC_SKIP_BEGIN
28 template class QWT_EXPORT QMap<double, QString>;
29 // MOC_SKIP_END
30 #endif
31 
32 #endif
33 
34 
35 class QwtCompassRose;
36 
48 class QWT_EXPORT QwtCompass: public QwtDial
49 {
50  Q_OBJECT
51 
52 public:
53  explicit QwtCompass( QWidget* parent = NULL);
54 #if QT_VERSION < 0x040000
55  explicit QwtCompass(QWidget* parent, const char *name);
56 #endif
57  virtual ~QwtCompass();
58 
59  void setRose(QwtCompassRose *rose);
60  const QwtCompassRose *rose() const;
61  QwtCompassRose *rose();
62 
63  const QMap<double, QString> &labelMap() const;
64  QMap<double, QString> &labelMap();
65  void setLabelMap(const QMap<double, QString> &map);
66 
67 protected:
68  virtual QwtText scaleLabel(double value) const;
69 
70  virtual void drawRose(QPainter *, const QPoint &center,
71  int radius, double north, QPalette::ColorGroup) const;
72 
73  virtual void drawScaleContents(QPainter *,
74  const QPoint &center, int radius) const;
75 
76  virtual void keyPressEvent(QKeyEvent *);
77 
78 private:
79  void initCompass();
80 
81  class PrivateData;
82  PrivateData *d_data;
83 };
84 
85 #endif