Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-06 08:50:55

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 // Qt-Security score:significant reason:default
0004 
0005 #ifndef QABSTRACTSLIDER_H
0006 #define QABSTRACTSLIDER_H
0007 
0008 #include <QtWidgets/qtwidgetsglobal.h>
0009 #include <QtWidgets/qwidget.h>
0010 
0011 QT_REQUIRE_CONFIG(abstractslider);
0012 
0013 QT_BEGIN_NAMESPACE
0014 
0015 
0016 class QAbstractSliderPrivate;
0017 
0018 class Q_WIDGETS_EXPORT QAbstractSlider : public QWidget
0019 {
0020     Q_OBJECT
0021 
0022     Q_PROPERTY(int minimum READ minimum WRITE setMinimum)
0023     Q_PROPERTY(int maximum READ maximum WRITE setMaximum)
0024     Q_PROPERTY(int singleStep READ singleStep WRITE setSingleStep)
0025     Q_PROPERTY(int pageStep READ pageStep WRITE setPageStep)
0026     Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged USER true)
0027     Q_PROPERTY(int sliderPosition READ sliderPosition WRITE setSliderPosition NOTIFY sliderMoved)
0028     Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking)
0029     Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
0030     Q_PROPERTY(bool invertedAppearance READ invertedAppearance WRITE setInvertedAppearance)
0031     Q_PROPERTY(bool invertedControls READ invertedControls WRITE setInvertedControls)
0032     Q_PROPERTY(bool sliderDown READ isSliderDown WRITE setSliderDown DESIGNABLE false)
0033 
0034 public:
0035     explicit QAbstractSlider(QWidget *parent = nullptr);
0036     ~QAbstractSlider();
0037 
0038     Qt::Orientation orientation() const;
0039 
0040     void setMinimum(int);
0041     int minimum() const;
0042 
0043     void setMaximum(int);
0044     int maximum() const;
0045 
0046     void setSingleStep(int);
0047     int singleStep() const;
0048 
0049     void setPageStep(int);
0050     int pageStep() const;
0051 
0052     void setTracking(bool enable);
0053     bool hasTracking() const;
0054 
0055     void setSliderDown(bool);
0056     bool isSliderDown() const;
0057 
0058     void setSliderPosition(int);
0059     int sliderPosition() const;
0060 
0061     void setInvertedAppearance(bool);
0062     bool invertedAppearance() const;
0063 
0064     void setInvertedControls(bool);
0065     bool invertedControls() const;
0066 
0067     enum SliderAction {
0068         SliderNoAction,
0069         SliderSingleStepAdd,
0070         SliderSingleStepSub,
0071         SliderPageStepAdd,
0072         SliderPageStepSub,
0073         SliderToMinimum,
0074         SliderToMaximum,
0075         SliderMove
0076     };
0077 
0078     int value() const;
0079 
0080     void triggerAction(SliderAction action);
0081 
0082 public Q_SLOTS:
0083     void setValue(int);
0084     void setOrientation(Qt::Orientation);
0085     void setRange(int min, int max);
0086 
0087 Q_SIGNALS:
0088     void valueChanged(int value);
0089 
0090     void sliderPressed();
0091     void sliderMoved(int position);
0092     void sliderReleased();
0093 
0094     void rangeChanged(int min, int max);
0095 
0096     void actionTriggered(int action);
0097 
0098 protected:
0099     bool event(QEvent *e) override;
0100 
0101     void setRepeatAction(SliderAction action, int thresholdTime = 500, int repeatTime = 50);
0102     SliderAction repeatAction() const;
0103 
0104     enum SliderChange {
0105         SliderRangeChange,
0106         SliderOrientationChange,
0107         SliderStepsChange,
0108         SliderValueChange
0109     };
0110     virtual void sliderChange(SliderChange change);
0111 
0112     void keyPressEvent(QKeyEvent *ev) override;
0113     void timerEvent(QTimerEvent *) override;
0114 #if QT_CONFIG(wheelevent)
0115     void wheelEvent(QWheelEvent *e) override;
0116 #endif
0117     void changeEvent(QEvent *e) override;
0118 
0119 
0120 protected:
0121     QAbstractSlider(QAbstractSliderPrivate &dd, QWidget *parent = nullptr);
0122 
0123 private:
0124     Q_DISABLE_COPY(QAbstractSlider)
0125     Q_DECLARE_PRIVATE(QAbstractSlider)
0126 };
0127 
0128 QT_END_NAMESPACE
0129 
0130 #endif // QABSTRACTSLIDER_H