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
qspinbox.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 QSPINBOX_H
5#define QSPINBOX_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qabstractspinbox.h>
9
11
13
14class QSpinBoxPrivate;
15class Q_WIDGETS_EXPORT QSpinBox : public QAbstractSpinBox
16{
18
19 Q_PROPERTY(QString suffix READ suffix WRITE setSuffix)
20 Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
21 Q_PROPERTY(QString cleanText READ cleanText)
22 Q_PROPERTY(int minimum READ minimum WRITE setMinimum)
23 Q_PROPERTY(int maximum READ maximum WRITE setMaximum)
24 Q_PROPERTY(int singleStep READ singleStep WRITE setSingleStep)
25 Q_PROPERTY(StepType stepType READ stepType WRITE setStepType)
26 Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged USER true)
27 Q_PROPERTY(int displayIntegerBase READ displayIntegerBase WRITE setDisplayIntegerBase)
28
29public:
30 explicit QSpinBox(QWidget *parent = nullptr);
31 ~QSpinBox();
32
33 int value() const;
34
35 QString prefix() const;
36 void setPrefix(const QString &prefix);
37
38 QString suffix() const;
39 void setSuffix(const QString &suffix);
40
41 QString cleanText() const;
42
43 int singleStep() const;
44 void setSingleStep(int val);
45
46 int minimum() const;
47 void setMinimum(int min);
48
49 int maximum() const;
50 void setMaximum(int max);
51
52 void setRange(int min, int max);
53
54 StepType stepType() const;
55 void setStepType(StepType stepType);
56
57 int displayIntegerBase() const;
58 void setDisplayIntegerBase(int base);
59
60protected:
61 bool event(QEvent *event) override;
62 QValidator::State validate(QString &input, int &pos) const override;
63 virtual int valueFromText(const QString &text) const;
64 virtual QString textFromValue(int val) const;
65 void fixup(QString &str) const override;
66
67
68public Q_SLOTS:
69 void setValue(int val);
70
72 void valueChanged(int);
73 void textChanged(const QString &);
74
76 Q_DISABLE_COPY(QSpinBox)
77 Q_DECLARE_PRIVATE(QSpinBox)
78};
79
81class Q_WIDGETS_EXPORT QDoubleSpinBox : public QAbstractSpinBox
82{
84
85 Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
86 Q_PROPERTY(QString suffix READ suffix WRITE setSuffix)
87 Q_PROPERTY(QString cleanText READ cleanText)
88 Q_PROPERTY(int decimals READ decimals WRITE setDecimals)
89 Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
90 Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
91 Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep)
92 Q_PROPERTY(StepType stepType READ stepType WRITE setStepType)
93 Q_PROPERTY(double value READ value WRITE setValue NOTIFY valueChanged USER true)
94public:
95 explicit QDoubleSpinBox(QWidget *parent = nullptr);
97
98 double value() const;
99
100 QString prefix() const;
101 void setPrefix(const QString &prefix);
102
103 QString suffix() const;
104 void setSuffix(const QString &suffix);
105
106 QString cleanText() const;
107
108 double singleStep() const;
109 void setSingleStep(double val);
110
111 double minimum() const;
112 void setMinimum(double min);
113
114 double maximum() const;
115 void setMaximum(double max);
116
117 void setRange(double min, double max);
118
119 StepType stepType() const;
120 void setStepType(StepType stepType);
121
122 int decimals() const;
123 void setDecimals(int prec);
124
125 QValidator::State validate(QString &input, int &pos) const override;
126 virtual double valueFromText(const QString &text) const;
127 virtual QString textFromValue(double val) const;
128 void fixup(QString &str) const override;
129
130public Q_SLOTS:
131 void setValue(double val);
132
134 void valueChanged(double);
135 void textChanged(const QString &);
136
137private:
138 Q_DISABLE_COPY(QDoubleSpinBox)
139 Q_DECLARE_PRIVATE(QDoubleSpinBox)
140};
141
143
144#endif // QSPINBOX_H
The QAbstractSpinBox class provides a spinbox and a line edit to display values.
StepType
\value DefaultStepType \value AdaptiveDecimalStepType
The QDoubleSpinBox class provides a spin box widget that takes doubles.
Definition qspinbox.h:82
\inmodule QtCore
Definition qcoreevent.h:45
The QSpinBox class provides a spin box widget.
Definition qspinbox.h:16
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QValidator class provides validation of input text.
Definition qvalidator.h:24
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
QString str
[2]
QString text
void textChanged(const QString &newText)
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
struct _cl_event * event
GLuint GLfloat * val
GLenum GLenum GLenum input
#define QT_REQUIRE_CONFIG(feature)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
static const uint base
Definition qurlidna.cpp:20
#define explicit
settings setValue("DataPump/bgcolor", color)
progressBar setRange(0, 100)
setMaximum(maximum)
sb setPrefix("$")
[0]
setMinimum(minimum)
[2]
sb setSuffix(" km")
[0]