Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickspinbox_p.h
Go to the documentation of this file.
1// Copyright (C) 2017 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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKSPINBOX_P_H
6#define QQUICKSPINBOX_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuickTemplates2/private/qquickcontrol_p.h>
20#include <QtQml/qjsvalue.h>
21
22QT_BEGIN_NAMESPACE
23
24class QValidator;
26class QQuickIndicatorButton;
27
28class Q_QUICKTEMPLATES2_EXPORT QQuickSpinBox : public QQuickControl
29{
30 Q_OBJECT
31 Q_PROPERTY(int from READ from WRITE setFrom NOTIFY fromChanged FINAL)
32 Q_PROPERTY(int to READ to WRITE setTo NOTIFY toChanged FINAL)
33 Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged FINAL)
34 Q_PROPERTY(int stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL)
35 Q_PROPERTY(bool editable READ isEditable WRITE setEditable NOTIFY editableChanged FINAL)
36 Q_PROPERTY(bool live READ isLive WRITE setLive NOTIFY liveChanged FINAL REVISION(6, 6))
37
38#if QT_CONFIG(validator)
39 Q_PROPERTY(QValidator *validator READ validator WRITE setValidator NOTIFY validatorChanged FINAL)
40#endif
41 Q_PROPERTY(QJSValue textFromValue READ textFromValue WRITE setTextFromValue NOTIFY textFromValueChanged FINAL)
42 Q_PROPERTY(QJSValue valueFromText READ valueFromText WRITE setValueFromText NOTIFY valueFromTextChanged FINAL)
43 Q_PROPERTY(QQuickIndicatorButton *up READ up CONSTANT FINAL)
44 Q_PROPERTY(QQuickIndicatorButton *down READ down CONSTANT FINAL)
45 // 2.2 (Qt 5.9)
46 Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints NOTIFY inputMethodHintsChanged FINAL REVISION(2, 2))
47 Q_PROPERTY(bool inputMethodComposing READ isInputMethodComposing NOTIFY inputMethodComposingChanged FINAL REVISION(2, 2))
48 // 2.3 (Qt 5.10)
49 Q_PROPERTY(bool wrap READ wrap WRITE setWrap NOTIFY wrapChanged FINAL REVISION(2, 3))
50 // 2.4 (Qt 5.11)
51 Q_PROPERTY(QString displayText READ displayText NOTIFY displayTextChanged FINAL REVISION(2, 4))
52 QML_NAMED_ELEMENT(SpinBox)
53 QML_ADDED_IN_VERSION(2, 0)
54
55public:
56 explicit QQuickSpinBox(QQuickItem *parent = nullptr);
57 ~QQuickSpinBox();
58
59 int from() const;
60 void setFrom(int from);
61
62 int to() const;
63 void setTo(int to);
64
65 int value() const;
66 void setValue(int value);
67
68 int stepSize() const;
69 void setStepSize(int step);
70
71 bool isEditable() const;
72 void setEditable(bool editable);
73
74 bool isLive() const;
75 void setLive(bool live);
76
77#if QT_CONFIG(validator)
78 QValidator *validator() const;
79 void setValidator(QValidator *validator);
80#endif
81
82 QJSValue textFromValue() const;
83 void setTextFromValue(const QJSValue &callback);
84
85 QJSValue valueFromText() const;
86 void setValueFromText(const QJSValue &callback);
87
88 QQuickIndicatorButton *up() const;
89 QQuickIndicatorButton *down() const;
90
91 // 2.2 (Qt 5.9)
92 Qt::InputMethodHints inputMethodHints() const;
93 void setInputMethodHints(Qt::InputMethodHints hints);
94
95 bool isInputMethodComposing() const;
96
97 // 2.3 (Qt 5.10)
98 bool wrap() const;
99 void setWrap(bool wrap);
100
101 // 2.4 (Qt 5.11)
102 QString displayText() const;
103
104public Q_SLOTS:
105 void increase();
106 void decrease();
107
108Q_SIGNALS:
109 void fromChanged();
110 void toChanged();
111 void valueChanged();
112 void stepSizeChanged();
113 void editableChanged();
114 Q_REVISION(6, 6) void liveChanged();
115#if QT_CONFIG(validator)
116 void validatorChanged();
117#endif
118 void textFromValueChanged();
119 void valueFromTextChanged();
120 // 2.2 (Qt 5.9)
121 Q_REVISION(2, 2) void valueModified();
122 Q_REVISION(2, 2) void inputMethodHintsChanged();
123 Q_REVISION(2, 2) void inputMethodComposingChanged();
124 // 2.3 (Qt 5.10)
125 Q_REVISION(2, 3) void wrapChanged();
126 // 2.4 (Qt 5.11)
127 Q_REVISION(2, 4) void displayTextChanged();
128
129protected:
130 void focusInEvent(QFocusEvent *event) override;
131 void hoverEnterEvent(QHoverEvent *event) override;
132 void hoverMoveEvent(QHoverEvent *event) override;
133 void hoverLeaveEvent(QHoverEvent *event) override;
134 void keyPressEvent(QKeyEvent *event) override;
135 void keyReleaseEvent(QKeyEvent *event) override;
136 void timerEvent(QTimerEvent *event) override;
137#if QT_CONFIG(wheelevent)
138 void wheelEvent(QWheelEvent *event) override;
139#endif
140
141 void classBegin() override;
142 void componentComplete() override;
143 void itemChange(ItemChange change, const ItemChangeData &value) override;
144 void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
145 void localeChange(const QLocale &newLocale, const QLocale &oldLocale) override;
146
147 QFont defaultFont() const override;
148
149#if QT_CONFIG(accessibility)
150 QAccessible::Role accessibleRole() const override;
151 void accessibilityActiveChanged(bool active) override;
152#endif
153
154private:
155 Q_DISABLE_COPY(QQuickSpinBox)
156 Q_DECLARE_PRIVATE(QQuickSpinBox)
157};
158
159QT_END_NAMESPACE
160
161#endif // QQUICKSPINBOX_P_H
Allows the user to select from a set of preset values.
void handleUngrab() override
int evaluateValueFromText(const QString &text) const
void itemDestroyed(QQuickItem *item) override
QQuickIndicatorButton * down
bool handleMove(const QPointF &point, ulong timestamp) override
bool handleRelease(const QPointF &point, ulong timestamp) override
Qt::InputMethodHints inputMethodHints
void decrease(bool modified)
void itemImplicitWidthChanged(QQuickItem *item) override
bool handlePress(const QPointF &point, ulong timestamp) override
bool stepBy(int steps, bool modified)
int effectiveStepSize() const
bool setValue(int value, bool wrap, bool modified)
void itemImplicitHeightChanged(QQuickItem *item) override
QString evaluateTextFromValue(int val) const
QQuickIndicatorButton * up
void updateHover(const QPointF &pos)
void increase(bool modified)
QPalette defaultPalette() const override
void setDisplayText(const QString &displayText)
static QT_BEGIN_NAMESPACE const int AUTO_REPEAT_DELAY
static const int AUTO_REPEAT_INTERVAL