Qwt User's Guide 6.3.0
Loading...
Searching...
No Matches
qwt_abstract_slider.h
1/******************************************************************************
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_ABSTRACT_SLIDER_H
11#define QWT_ABSTRACT_SLIDER_H
12
13#include "qwt_global.h"
14#include "qwt_abstract_scale.h"
15
32class QWT_EXPORT QwtAbstractSlider : public QwtAbstractScale
33{
34 Q_OBJECT
35
36 Q_PROPERTY( double value READ value WRITE setValue NOTIFY valueChanged USER true )
37
38 Q_PROPERTY( uint totalSteps READ totalSteps WRITE setTotalSteps )
39 Q_PROPERTY( uint singleSteps READ singleSteps WRITE setSingleSteps )
40 Q_PROPERTY( uint pageSteps READ pageSteps WRITE setPageSteps )
41 Q_PROPERTY( bool stepAlignment READ stepAlignment WRITE setStepAlignment )
42
43 Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
44 Q_PROPERTY( bool tracking READ isTracking WRITE setTracking )
45 Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping )
46
47 Q_PROPERTY( bool invertedControls READ invertedControls WRITE setInvertedControls )
48
49 public:
50 explicit QwtAbstractSlider( QWidget* parent = NULL );
51 virtual ~QwtAbstractSlider();
52
53 void setValid( bool );
54 bool isValid() const;
55
56 double value() const;
57
58 void setWrapping( bool );
59 bool wrapping() const;
60
61 void setTotalSteps( uint );
62 uint totalSteps() const;
63
64 void setSingleSteps( uint );
65 uint singleSteps() const;
66
67 void setPageSteps( uint );
68 uint pageSteps() const;
69
70 void setStepAlignment( bool );
71 bool stepAlignment() const;
72
73 void setTracking( bool );
74 bool isTracking() const;
75
76 void setReadOnly( bool );
77 bool isReadOnly() const;
78
79 void setInvertedControls( bool );
80 bool invertedControls() const;
81
82 public Q_SLOTS:
83 void setValue( double value );
84
85 Q_SIGNALS:
86
97 void valueChanged( double value );
98
104
110
119 void sliderMoved( double value );
120
121 protected:
122 virtual void mousePressEvent( QMouseEvent* ) QWT_OVERRIDE;
123 virtual void mouseReleaseEvent( QMouseEvent* ) QWT_OVERRIDE;
124 virtual void mouseMoveEvent( QMouseEvent* ) QWT_OVERRIDE;
125 virtual void keyPressEvent( QKeyEvent* ) QWT_OVERRIDE;
126 virtual void wheelEvent( QWheelEvent* ) QWT_OVERRIDE;
127
136 virtual bool isScrollPosition( const QPoint& pos ) const = 0;
137
147 virtual double scrolledTo( const QPoint& pos ) const = 0;
148
149 void incrementValue( int stepCount );
150
151 virtual void scaleChange() QWT_OVERRIDE;
152
153 protected:
154 virtual void sliderChange();
155
156 double incrementedValue(
157 double value, int stepCount ) const;
158
159 private:
160 double alignedValue( double ) const;
161 double boundedValue( double ) const;
162
163 class PrivateData;
164 PrivateData* m_data;
165};
166
167#endif
An abstract base class for widgets having a scale.
virtual void scaleChange()
Notify changed scale.
An abstract base class for slider widgets with a scale.
void valueChanged(double value)
Notify a change of value.
void sliderMoved(double value)
virtual bool isScrollPosition(const QPoint &pos) const =0
Determine what to do when the user presses a mouse button.
virtual double scrolledTo(const QPoint &pos) const =0
Determine the value for a new position of the movable part of the slider.