source: pacpusframework/branches/2.0-beta1/include/extlib/qwt-5.2.1/qwt_knob.h@ 89

Last change on this file since 89 was 89, checked in by morasjul, 11 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 2.9 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_KNOB_H
11#define QWT_KNOB_H
12
13#include "qwt_global.h"
14#include "qwt_abstract_slider.h"
15#include "qwt_abstract_scale.h"
16
17class QwtRoundScaleDraw;
18
19/*!
20 \brief The Knob Widget
21
22 The QwtKnob widget imitates look and behaviour of a volume knob on a radio.
23 It contains a scale around the knob which is set up automatically or can
24 be configured manually (see QwtAbstractScale).
25 Automatic scrolling is enabled when the user presses a mouse
26 button on the scale. For a description of signals, slots and other
27 members, see QwtAbstractSlider.
28
29 \image html knob.png
30 \sa QwtAbstractSlider and QwtAbstractScale for the descriptions
31 of the inherited members.
32*/
33
34class QWT_EXPORT QwtKnob : public QwtAbstractSlider, public QwtAbstractScale
35{
36 Q_OBJECT
37 Q_ENUMS (Symbol)
38 Q_PROPERTY( int knobWidth READ knobWidth WRITE setKnobWidth )
39 Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
40 Q_PROPERTY( double totalAngle READ totalAngle WRITE setTotalAngle )
41 Q_PROPERTY( Symbol symbol READ symbol WRITE setSymbol )
42
43public:
44 /*!
45 Symbol
46 \sa QwtKnob::QwtKnob()
47 */
48
49 enum Symbol { Line, Dot };
50
51 explicit QwtKnob(QWidget* parent = NULL);
52#if QT_VERSION < 0x040000
53 explicit QwtKnob(QWidget* parent, const char *name);
54#endif
55 virtual ~QwtKnob();
56
57 void setKnobWidth(int w);
58 int knobWidth() const;
59
60 void setTotalAngle (double angle);
61 double totalAngle() const;
62
63 void setBorderWidth(int bw);
64 int borderWidth() const;
65
66 void setSymbol(Symbol);
67 Symbol symbol() const;
68
69 virtual QSize sizeHint() const;
70 virtual QSize minimumSizeHint() const;
71
72 void setScaleDraw(QwtRoundScaleDraw *);
73 const QwtRoundScaleDraw *scaleDraw() const;
74 QwtRoundScaleDraw *scaleDraw();
75
76protected:
77 virtual void paintEvent(QPaintEvent *e);
78 virtual void resizeEvent(QResizeEvent *e);
79
80 void draw(QPainter *p, const QRect& ur);
81 void drawKnob(QPainter *p, const QRect &r);
82 void drawMarker(QPainter *p, double arc, const QColor &c);
83
84private:
85 void initKnob();
86 void layoutKnob( bool update = true );
87 double getValue(const QPoint &p);
88 void getScrollMode( const QPoint &p, int &scrollMode, int &direction );
89 void recalcAngle();
90
91 virtual void valueChange();
92 virtual void rangeChange();
93 virtual void scaleChange();
94 virtual void fontChange(const QFont &oldFont);
95
96 class PrivateData;
97 PrivateData *d_data;
98};
99
100#endif
Note: See TracBrowser for help on using the repository browser.