Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qabstractspinbox.h
Go to the documentation of this file.
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#ifndef QABSTRACTSPINBOX_H
5#define QABSTRACTSPINBOX_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qwidget.h>
9#include <QtGui/qvalidator.h>
10
12
14
15class QLineEdit;
16
18class QStyleOptionSpinBox;
19
20class Q_WIDGETS_EXPORT QAbstractSpinBox : public QWidget
21{
23
24 Q_PROPERTY(bool wrapping READ wrapping WRITE setWrapping)
25 Q_PROPERTY(bool frame READ hasFrame WRITE setFrame)
27 Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
28 Q_PROPERTY(ButtonSymbols buttonSymbols READ buttonSymbols WRITE setButtonSymbols)
29 Q_PROPERTY(QString specialValueText READ specialValueText WRITE setSpecialValueText)
31 Q_PROPERTY(bool accelerated READ isAccelerated WRITE setAccelerated)
32 Q_PROPERTY(CorrectionMode correctionMode READ correctionMode WRITE setCorrectionMode)
33 Q_PROPERTY(bool acceptableInput READ hasAcceptableInput)
34 Q_PROPERTY(bool keyboardTracking READ keyboardTracking WRITE setKeyboardTracking)
35 Q_PROPERTY(bool showGroupSeparator READ isGroupSeparatorShown WRITE setGroupSeparatorShown)
36public:
37 explicit QAbstractSpinBox(QWidget *parent = nullptr);
39
40 enum StepEnabledFlag { StepNone = 0x00, StepUpEnabled = 0x01,
41 StepDownEnabled = 0x02 };
42 Q_DECLARE_FLAGS(StepEnabled, StepEnabledFlag)
43
44 enum ButtonSymbols { UpDownArrows, PlusMinus, NoButtons };
45 Q_ENUM(ButtonSymbols)
46
47 ButtonSymbols buttonSymbols() const;
48 void setButtonSymbols(ButtonSymbols bs);
49
50 enum CorrectionMode { CorrectToPreviousValue, CorrectToNearestValue };
51 Q_ENUM(CorrectionMode)
52
53 void setCorrectionMode(CorrectionMode cm);
54 CorrectionMode correctionMode() const;
55
56 bool hasAcceptableInput() const;
57 QString text() const;
58
59 QString specialValueText() const;
60 void setSpecialValueText(const QString &txt);
61
62 bool wrapping() const;
63 void setWrapping(bool w);
64
65 void setReadOnly(bool r);
66 bool isReadOnly() const;
67
68 void setKeyboardTracking(bool kt);
69 bool keyboardTracking() const;
70
71 void setAlignment(Qt::Alignment flag);
72 Qt::Alignment alignment() const;
73
74 void setFrame(bool);
75 bool hasFrame() const;
76
77 void setAccelerated(bool on);
78 bool isAccelerated() const;
79
80 void setGroupSeparatorShown(bool shown);
81 bool isGroupSeparatorShown() const;
82
83 QSize sizeHint() const override;
84 QSize minimumSizeHint() const override;
85 void interpretText();
86 bool event(QEvent *event) override;
87
88 QVariant inputMethodQuery(Qt::InputMethodQuery) const override;
89
90 virtual QValidator::State validate(QString &input, int &pos) const;
91 virtual void fixup(QString &input) const;
92
93 virtual void stepBy(int steps);
94
95 enum StepType {
97 AdaptiveDecimalStepType
98 };
99 Q_ENUM(StepType)
100
101public Q_SLOTS:
102 void stepUp();
103 void stepDown();
104 void selectAll();
105 virtual void clear();
106protected:
107 void resizeEvent(QResizeEvent *event) override;
108 void keyPressEvent(QKeyEvent *event) override;
109 void keyReleaseEvent(QKeyEvent *event) override;
110#if QT_CONFIG(wheelevent)
111 void wheelEvent(QWheelEvent *event) override;
112#endif
113 void focusInEvent(QFocusEvent *event) override;
114 void focusOutEvent(QFocusEvent *event) override;
115#if QT_CONFIG(contextmenu)
116 void contextMenuEvent(QContextMenuEvent *event) override;
117#endif
118 void changeEvent(QEvent *event) override;
119 void closeEvent(QCloseEvent *event) override;
120 void hideEvent(QHideEvent *event) override;
121 void mousePressEvent(QMouseEvent *event) override;
122 void mouseReleaseEvent(QMouseEvent *event) override;
123 void mouseMoveEvent(QMouseEvent *event) override;
124 void timerEvent(QTimerEvent *event) override;
125 void paintEvent(QPaintEvent *event) override;
126 void showEvent(QShowEvent *event) override;
127 virtual void initStyleOption(QStyleOptionSpinBox *option) const;
128
129 QLineEdit *lineEdit() const;
130 void setLineEdit(QLineEdit *edit);
131
132 virtual StepEnabled stepEnabled() const;
135protected:
136 QAbstractSpinBox(QAbstractSpinBoxPrivate &dd, QWidget *parent = nullptr);
137
138private:
139 Q_DECLARE_PRIVATE(QAbstractSpinBox)
140 Q_DISABLE_COPY(QAbstractSpinBox)
141 friend class QAccessibleAbstractSpinBox;
142};
144
146
147#endif // QABSTRACTSPINBOX_H
The QAbstractSpinBox class provides a spinbox and a line edit to display values.
void editingFinished()
This signal is emitted editing is finished.
StepEnabledFlag
\value StepNone \value StepUpEnabled \value StepDownEnabled
CorrectionMode
This enum type describes the mode the spinbox will use to correct an \l{QValidator::}{Intermediate} v...
StepType
\value DefaultStepType \value AdaptiveDecimalStepType
ButtonSymbols
This enum type describes the symbols that can be displayed on the buttons in a spin box.
The QCloseEvent class contains parameters that describe a close event.
Definition qevent.h:562
The QContextMenuEvent class contains parameters that describe a context menu event.
Definition qevent.h:594
\inmodule QtCore
Definition qcoreevent.h:45
The QFocusEvent class contains event parameters for widget focus events.
Definition qevent.h:470
The QHideEvent class provides an event which is sent after a widget is hidden.
Definition qevent.h:586
The QKeyEvent class describes a key event.
Definition qevent.h:424
The QLineEdit widget is a one-line text editor.
Definition qlineedit.h:28
\inmodule QtGui
Definition qevent.h:196
The QPaintEvent class contains event parameters for paint events.
Definition qevent.h:486
The QResizeEvent class contains event parameters for resize events.
Definition qevent.h:548
The QShowEvent class provides an event that is sent when a widget is shown.
Definition qevent.h:578
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qcoreevent.h:366
State
This enum type defines the states in which a validated string can exist.
Definition qvalidator.h:30
\inmodule QtCore
Definition qvariant.h:65
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
b clear()
QString text
uint alignment
Combined button and popup list for selecting options.
Definition qcompare.h:63
InputMethodQuery
static jboolean selectAll(JNIEnv *, jobject)
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
GLfloat GLfloat GLfloat w
[0]
GLboolean r
[2]
struct _cl_event * event
GLuint GLenum option
GLenum GLenum GLenum input
#define QT_REQUIRE_CONFIG(feature)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
#define explicit
label setAlignment(Qt::AlignLeft|Qt::AlignTop)
[0]
QLineEdit * lineEdit
Text files * txt
QFrame frame
[0]
spinBox setWrapping(true)
spinBox stepBy(1)