Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef QABSTRACTSLIDER_H
00043 #define QABSTRACTSLIDER_H
00044
00045 #include <QtGui/qwidget.h>
00046
00047 QT_BEGIN_HEADER
00048
00049 QT_BEGIN_NAMESPACE
00050
00051 QT_MODULE(Gui)
00052
00053 class QAbstractSliderPrivate;
00054
00055 class Q_GUI_EXPORT QAbstractSlider : public QWidget
00056 {
00057 Q_OBJECT
00058
00059 Q_PROPERTY(int minimum READ minimum WRITE setMinimum)
00060 Q_PROPERTY(int maximum READ maximum WRITE setMaximum)
00061 Q_PROPERTY(int singleStep READ singleStep WRITE setSingleStep)
00062 Q_PROPERTY(int pageStep READ pageStep WRITE setPageStep)
00063 Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged USER true)
00064 Q_PROPERTY(int sliderPosition READ sliderPosition WRITE setSliderPosition NOTIFY sliderMoved)
00065 Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking)
00066 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
00067 Q_PROPERTY(bool invertedAppearance READ invertedAppearance WRITE setInvertedAppearance)
00068 Q_PROPERTY(bool invertedControls READ invertedControls WRITE setInvertedControls)
00069 Q_PROPERTY(bool sliderDown READ isSliderDown WRITE setSliderDown DESIGNABLE false)
00070
00071 public:
00072 explicit QAbstractSlider(QWidget *parent=0);
00073 ~QAbstractSlider();
00074
00075 Qt::Orientation orientation() const;
00076
00077 void setMinimum(int);
00078 int minimum() const;
00079
00080 void setMaximum(int);
00081 int maximum() const;
00082
00083 void setRange(int min, int max);
00084
00085 void setSingleStep(int);
00086 int singleStep() const;
00087
00088 void setPageStep(int);
00089 int pageStep() const;
00090
00091 void setTracking(bool enable);
00092 bool hasTracking() const;
00093
00094 void setSliderDown(bool);
00095 bool isSliderDown() const;
00096
00097 void setSliderPosition(int);
00098 int sliderPosition() const;
00099
00100 void setInvertedAppearance(bool);
00101 bool invertedAppearance() const;
00102
00103 void setInvertedControls(bool);
00104 bool invertedControls() const;
00105
00106 enum SliderAction {
00107 SliderNoAction,
00108 SliderSingleStepAdd,
00109 SliderSingleStepSub,
00110 SliderPageStepAdd,
00111 SliderPageStepSub,
00112 SliderToMinimum,
00113 SliderToMaximum,
00114 SliderMove
00115 };
00116
00117 int value() const;
00118
00119 void triggerAction(SliderAction action);
00120
00121 public Q_SLOTS:
00122 void setValue(int);
00123 void setOrientation(Qt::Orientation);
00124
00125 Q_SIGNALS:
00126 void valueChanged(int value);
00127
00128 void sliderPressed();
00129 void sliderMoved(int position);
00130 void sliderReleased();
00131
00132 void rangeChanged(int min, int max);
00133
00134 void actionTriggered(int action);
00135
00136 protected:
00137 bool event(QEvent *e);
00138
00139 void setRepeatAction(SliderAction action, int thresholdTime = 500, int repeatTime = 50);
00140 SliderAction repeatAction() const;
00141
00142 enum SliderChange {
00143 SliderRangeChange,
00144 SliderOrientationChange,
00145 SliderStepsChange,
00146 SliderValueChange
00147 };
00148 virtual void sliderChange(SliderChange change);
00149
00150 void keyPressEvent(QKeyEvent *ev);
00151 void timerEvent(QTimerEvent *);
00152 #ifndef QT_NO_WHEELEVENT
00153 void wheelEvent(QWheelEvent *e);
00154 #endif
00155 void changeEvent(QEvent *e);
00156
00157 #ifdef QT3_SUPPORT
00158 public:
00159 inline QT3_SUPPORT int minValue() const { return minimum(); }
00160 inline QT3_SUPPORT int maxValue() const { return maximum(); }
00161 inline QT3_SUPPORT int lineStep() const { return singleStep(); }
00162 inline QT3_SUPPORT void setMinValue(int v) { setMinimum(v); }
00163 inline QT3_SUPPORT void setMaxValue(int v) { setMaximum(v); }
00164 inline QT3_SUPPORT void setLineStep(int v) { setSingleStep(v); }
00165 inline QT3_SUPPORT void setSteps(int single, int page) { setSingleStep(single); setPageStep(page); }
00166 inline QT3_SUPPORT void addPage() { triggerAction(SliderPageStepAdd); }
00167 inline QT3_SUPPORT void subtractPage() { triggerAction(SliderPageStepSub); }
00168 inline QT3_SUPPORT void addLine() { triggerAction(SliderSingleStepAdd); }
00169 inline QT3_SUPPORT void subtractLine() { triggerAction(SliderSingleStepSub); }
00170 #endif
00171
00172 protected:
00173 QAbstractSlider(QAbstractSliderPrivate &dd, QWidget *parent=0);
00174
00175 private:
00176 Q_DISABLE_COPY(QAbstractSlider)
00177 Q_DECLARE_PRIVATE(QAbstractSlider)
00178 };
00179
00180 QT_END_NAMESPACE
00181
00182 QT_END_HEADER
00183
00184 #endif // QABSTRACTSLIDER_H