1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
5#ifndef QDIAL_H
6#define QDIAL_H
7
8#include <QtWidgets/qtwidgetsglobal.h>
9
10#include <QtWidgets/qabstractslider.h>
11
12QT_REQUIRE_CONFIG(dial);
13
14QT_BEGIN_NAMESPACE
15
16class QDialPrivate;
17class QStyleOptionSlider;
18
19class Q_WIDGETS_EXPORT QDial: public QAbstractSlider
20{
21 Q_OBJECT
22
23 Q_PROPERTY(bool wrapping READ wrapping WRITE setWrapping)
24 Q_PROPERTY(int notchSize READ notchSize)
25 Q_PROPERTY(qreal notchTarget READ notchTarget WRITE setNotchTarget)
26 Q_PROPERTY(bool notchesVisible READ notchesVisible WRITE setNotchesVisible)
27public:
28 explicit QDial(QWidget *parent = nullptr);
29
30 ~QDial();
31
32 bool wrapping() const;
33
34 int notchSize() const;
35
36 void setNotchTarget(double target);
37 qreal notchTarget() const;
38 bool notchesVisible() const;
39
40 QSize sizeHint() const override;
41 QSize minimumSizeHint() const override;
42
43public Q_SLOTS:
44 void setNotchesVisible(bool visible);
45 void setWrapping(bool on);
46
47protected:
48 bool event(QEvent *e) override;
49 void resizeEvent(QResizeEvent *re) override;
50 void paintEvent(QPaintEvent *pe) override;
51
52 void mousePressEvent(QMouseEvent *me) override;
53 void mouseReleaseEvent(QMouseEvent *me) override;
54 void mouseMoveEvent(QMouseEvent *me) override;
55
56 void sliderChange(SliderChange change) override;
57 virtual void initStyleOption(QStyleOptionSlider *option) const;
58
59
60private:
61 Q_DECLARE_PRIVATE(QDial)
62 Q_DISABLE_COPY(QDial)
63};
64
65QT_END_NAMESPACE
66
67#endif // QDIAL_H
68

source code of qtbase/src/widgets/widgets/qdial.h