Qwt User's Guide  5.2.3
qwt_wheel.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_WHEEL_H
11 #define QWT_WHEEL_H
12 
13 #include "qwt_global.h"
14 #include "qwt_abstract_slider.h"
15 
25 class QWT_EXPORT QwtWheel : public QwtAbstractSlider
26 {
27  Q_OBJECT
28  Q_PROPERTY( double totalAngle READ totalAngle WRITE setTotalAngle )
29  Q_PROPERTY( double viewAngle READ viewAngle WRITE setViewAngle )
30  Q_PROPERTY( int tickCnt READ tickCnt WRITE setTickCnt )
31  Q_PROPERTY( int internalBorder READ internalBorder WRITE setInternalBorder )
32  Q_PROPERTY( double mass READ mass WRITE setMass )
33 
34 public:
35  explicit QwtWheel(QWidget *parent = NULL);
36 #if QT_VERSION < 0x040000
37  explicit QwtWheel(QWidget *parent, const char *name);
38 #endif
39  virtual ~QwtWheel();
40 
41  virtual void setOrientation(Qt::Orientation);
42 
43  double totalAngle() const;
44  double viewAngle() const;
45  int tickCnt() const;
46  int internalBorder() const;
47 
48  double mass() const;
49 
50  void setTotalAngle (double angle);
51  void setTickCnt(int cnt);
52  void setViewAngle(double angle);
53  void setInternalBorder(int width);
54  void setMass(double val);
55  void setWheelWidth( int w );
56 
57  virtual QSize sizeHint() const;
58  virtual QSize minimumSizeHint() const;
59 
60 protected:
61  virtual void resizeEvent(QResizeEvent *e);
62  virtual void paintEvent(QPaintEvent *e);
63 
64  void layoutWheel( bool update = true );
65  void draw(QPainter *, const QRect &);
66  void drawWheel(QPainter *, const QRect &);
67  void drawWheelBackground(QPainter *, const QRect &);
68  void setColorArray();
69 
70  virtual void valueChange();
71  virtual void paletteChange( const QPalette &);
72 
73  virtual double getValue(const QPoint &);
74  virtual void getScrollMode(const QPoint &,
75  int &scrollMode, int &direction);
76 
77 private:
78  void initWheel();
79 
80  class PrivateData;
81  PrivateData *d_data;
82 };
83 
84 #endif