source: ntrip/trunk/BNC/qwt/qwt_slider.h@ 8474

Last change on this file since 8474 was 8127, checked in by stoecker, 8 years ago

update qwt and qwtpolar, many QT5 fixes (unfinished)

File size: 3.4 KB
RevLine 
[8127]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
16class QwtScaleDraw;
17
18/*!
19 \brief The Slider Widget
20
21 QwtSlider is a slider widget which operates on an interval
22 of type double. Its position is related to a scale showing
23 the current value.
24
25 The slider can be customized by having a through, a groove - or both.
26
27 \image html sliders.png
28*/
29
30class 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
48public:
49
50 /*!
51 Position of the scale
52 \sa QwtSlider(), setScalePosition(), setOrientation()
53 */
54 enum ScalePosition
55 {
56 //! The slider has no scale
57 NoScale,
58
59 //! The scale is right of a vertical or below a horizontal slider
60 LeadingScale,
61
62 //! The scale is left of a vertical or above a horizontal slider
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
101protected:
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
120private:
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
Note: See TracBrowser for help on using the repository browser.