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
qabstractspinbox_p.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_P_H
5#define QABSTRACTSPINBOX_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtWidgets/private/qtwidgetsglobal_p.h>
19#include "QtWidgets/qabstractspinbox.h"
20
21#include "QtWidgets/qlineedit.h"
22#include "QtWidgets/qstyleoption.h"
23#include "QtGui/qvalidator.h"
24#include "QtCore/qbasictimer.h"
25#include "QtCore/qdatetime.h"
26#include "QtCore/qvariant.h"
27#include "private/qwidget_p.h"
28
30
32
33QVariant operator+(const QVariant &arg1, const QVariant &arg2);
34QVariant operator-(const QVariant &arg1, const QVariant &arg2);
35QVariant operator*(const QVariant &arg1, double multiplier);
36double operator/(const QVariant &arg1, const QVariant &arg2);
37
43
44enum Button {
45 None = 0x000,
46 Keyboard = 0x001,
47 Mouse = 0x002,
48 Wheel = 0x004,
49 ButtonMask = 0x008,
50 Up = 0x010,
51 Down = 0x020,
52 DirectionMask = 0x040
53};
56{
57 Q_DECLARE_PUBLIC(QAbstractSpinBox)
58public:
61
62 void init();
63 void reset();
64 void updateState(bool up, bool fromKeyboard = false);
65 QString stripped(const QString &text, int *pos = nullptr) const;
66 bool specialValue() const;
67 virtual QVariant getZeroVariant() const;
68 virtual void setRange(const QVariant &min, const QVariant &max);
69 void setValue(const QVariant &val, EmitPolicy ep, bool updateEdit = true);
70 virtual QVariant bound(const QVariant &val, const QVariant &old = QVariant(), int steps = 0) const;
71 virtual void updateEdit();
72
73 virtual void emitSignals(EmitPolicy ep, const QVariant &old);
74 virtual void interpret(EmitPolicy ep);
75 virtual QString textFromValue(const QVariant &n) const;
76 virtual QVariant valueFromText(const QString &input) const;
77
78 void editorTextChanged(const QString &);
79 virtual void editorCursorPositionChanged(int oldpos, int newpos);
80
81 virtual QStyle::SubControl newHoverControl(const QPoint &pos);
82 bool updateHoverControl(const QPoint &pos);
83
84 virtual void clearCache() const;
85 virtual void updateEditFieldGeometry();
86
87 static int variantCompare(const QVariant &arg1, const QVariant &arg2);
88 static QVariant variantBound(const QVariant &min, const QVariant &value, const QVariant &max);
89
90 virtual QVariant calculateAdaptiveDecimalStep(int steps) const;
91
95
96 mutable QString cachedText = { u'\x01' };
99 QLineEdit *edit = nullptr;
109
128};
129
131{
132public:
133 QSpinBoxValidator(QAbstractSpinBox *qptr, QAbstractSpinBoxPrivate *dptr);
134 QValidator::State validate(QString &input, int &) const override;
135 void fixup(QString &) const override;
136private:
137 QAbstractSpinBox *qptr;
139};
140
141QT_END_NAMESPACE
142
143#endif // QABSTRACTSPINBOX_P_H
virtual QVariant valueFromText(const QString &input) const
virtual void emitSignals(EmitPolicy ep, const QVariant &old)
virtual QStyle::SubControl newHoverControl(const QPoint &pos)
static QVariant variantBound(const QVariant &min, const QVariant &value, const QVariant &max)
virtual QVariant getZeroVariant() const
virtual void editorCursorPositionChanged(int oldpos, int newpos)
virtual void setRange(const QVariant &min, const QVariant &max)
QSpinBoxValidator * validator
static int variantCompare(const QVariant &arg1, const QVariant &arg2)
QString stripped(const QString &text, int *pos=nullptr) const
Qt::KeyboardModifier stepModifier
Qt::KeyboardModifiers keyboardModifiers
void editorTextChanged(const QString &)
virtual void interpret(EmitPolicy ep)
QStyle::SubControl hoverControl
virtual void updateEditFieldGeometry()
virtual QString textFromValue(const QVariant &n) const
void updateState(bool up, bool fromKeyboard=false)
virtual QVariant bound(const QVariant &val, const QVariant &old=QVariant(), int steps=0) const
virtual void clearCache() const
QValidator::State cachedState
void setValue(const QVariant &val, EmitPolicy ep, bool updateEdit=true)
bool updateHoverControl(const QPoint &pos)
virtual QVariant calculateAdaptiveDecimalStep(int steps) const
void fixup(QString &) const override
QSpinBoxValidator(QAbstractSpinBox *qptr, QAbstractSpinBoxPrivate *dptr)
QValidator::State validate(QString &input, int &) const override
\inmodule QtCore
Definition qvariant.h:65
QT_REQUIRE_CONFIG(spinbox)
@ Keyboard
@ DirectionMask
@ ButtonMask
@ EmitIfChanged
@ NeverEmit
@ AlwaysEmit
QDoubleMatrix4x4 operator*(const QDoubleMatrix4x4 &matrix, double factor)
Button
constexpr QRect operator-(const QRect &lhs, const QMargins &rhs) noexcept
Definition qrect.h:442
QPointF operator/(const QPointF &p1, const QPointF &p2)
Definition qscroller.cpp:90