Qwt User's Guide 6.1.1

- Main Page
- Related Pages
- Classes

All Classes Functions Variables Typedefs Enumerations Enumerator Pages
qwt_slider.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_SLIDER_H
11 #define QWT_SLIDER_H
12
13 #include "qwt_global.h"
14 #include "qwt_abstract_slider.h"
15
16 class QwtScaleDraw;
17
30 class QWT_EXPORT QwtSlider: public QwtAbstractSlider
31 {
32 Q_OBJECT
33
34 Q_ENUMS( ScalePosition BackgroundStyle )
35
36 Q_PROPERTY( Qt::Orientation orientation
37 READ orientation WRITE setOrientation )
38 Q_PROPERTY( ScalePosition scalePosition READ scalePosition
39 WRITE setScalePosition )
40
41 Q_PROPERTY( bool trough READ hasTrough WRITE setTrough )
42 Q_PROPERTY( bool groove READ hasGroove WRITE setGroove )
43
44 Q_PROPERTY( QSize handleSize READ handleSize WRITE setHandleSize )
45 Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
46 Q_PROPERTY( int spacing READ spacing WRITE setSpacing )
47
48 public:
49
54 enum ScalePosition
55 {
57 NoScale,
58
60 LeadingScale,
61
63 TrailingScale
64 };
65
66 explicit QwtSlider( QWidget *parent = NULL );
67 explicit QwtSlider( Qt::Orientation, QWidget *parent = NULL );
68
69 virtual ~QwtSlider();
70
71 void setOrientation( Qt::Orientation );
72 Qt::Orientation orientation() const;
73
74 void setScalePosition( ScalePosition );
75 ScalePosition scalePosition() const;
76
77 void setTrough( bool );
78 bool hasTrough() const;
79
80 void setGroove( bool );
81 bool hasGroove() const;
82
83 void setHandleSize( const QSize & );
84 QSize handleSize() const;
85
86 void setBorderWidth( int bw );
87 int borderWidth() const;
88
89 void setSpacing( int );
90 int spacing() const;
91
92 virtual QSize sizeHint() const;
93 virtual QSize minimumSizeHint() const;
94
95 void setScaleDraw( QwtScaleDraw * );
96 const QwtScaleDraw *scaleDraw() const;
97
98 void setUpdateInterval( int );
99 int updateInterval() const;
100
101 protected:
102 virtual double scrolledTo( const QPoint & ) const;
103 virtual bool isScrollPosition( const QPoint & ) const;
104
105 virtual void drawSlider ( QPainter *, const QRect & ) const;
106 virtual void drawHandle( QPainter *, const QRect &, int pos ) const;
107
108 virtual void mousePressEvent( QMouseEvent * );
109 virtual void mouseReleaseEvent( QMouseEvent * );
110 virtual void resizeEvent( QResizeEvent * );
111 virtual void paintEvent ( QPaintEvent * );
112 virtual void changeEvent( QEvent * );
113 virtual void timerEvent( QTimerEvent * );
114
115 virtual void scaleChange();
116
117 QRect sliderRect() const;
118 QRect handleRect() const;
119
120 private:
121 QwtScaleDraw *scaleDraw();
122
123 void layoutSlider( bool );
124 void initSlider( Qt::Orientation );
125
126 class PrivateData;
127 PrivateData *d_data;
128 };
129
130 #endif
QwtScaleDraw
A class for drawing scales.
Definition: qwt_scale_draw.h:31
QwtSlider::NoScale
The slider has no scale.
Definition: qwt_slider.h:57
QwtAbstractSlider::mousePressEvent
virtual void mousePressEvent(QMouseEvent *)
Definition: qwt_abstract_slider.cpp:198
QwtSlider::LeadingScale
The scale is right of a vertical or below a horizontal slider.
Definition: qwt_slider.h:60
QwtAbstractSlider::scaleChange
virtual void scaleChange()
Definition: qwt_abstract_slider.cpp:801
QwtAbstractSlider::scrolledTo
virtual double scrolledTo(const QPoint &pos) const =0
Determine the value for a new position of the movable part of the slider.
QwtAbstractSlider
An abstract base class for slider widgets with a scale.
Definition: qwt_abstract_slider.h:32
QwtSlider::ScalePosition
ScalePosition
Definition: qwt_slider.h:54
QwtAbstractSlider::mouseReleaseEvent
virtual void mouseReleaseEvent(QMouseEvent *)
Definition: qwt_abstract_slider.cpp:268
QwtSlider
The Slider Widget.
Definition: qwt_slider.h:30
QwtAbstractSlider::isScrollPosition
virtual bool isScrollPosition(const QPoint &pos) const =0
Determine what to do when the user presses a mouse button.