9#include <QtGui/qguiapplication.h>
10#include <QtGui/qstylehints.h>
12#include <QtQml/qqmlinfo.h>
13#if QT_CONFIG(qml_locale)
14#include <QtQml/private/qqmllocale_p.h>
16#include <QtQml/private/qqmlengine_p.h>
17#include <QtQuick/private/qquicktextinput_p.h>
87 bool stepBy(
int steps,
bool modified);
132#if QT_CONFIG(validator)
142 bool inverted =
from >
to;
160 if (
text.isValid()) {
173 int correctedValue = newValue;
174 if (
q->isComponentComplete())
175 correctedValue =
boundValue(newValue, allowWrap);
177 if (!modified && newValue == correctedValue && newValue ==
value)
180 const bool emitSignals = (
value != correctedValue);
181 value = correctedValue;
190 emit q->valueChanged();
192 emit q->valueModified();
230 emit q->displayTextChanged();
237 QQuickTextInput *inputTextItem = qobject_cast<QQuickTextInput *>(
q->contentItem());
241 validator->fixup(
text);
245 const int correctedValue =
boundValue(enteredVal,
false);
246 if (correctedValue == enteredVal && correctedValue !=
value) {
249 q->setValue(correctedValue);
260 return upIndicator && upIndicator->
isEnabled();
275 return downIndicator && downIndicator->
isEnabled();
333 q->setAccessibleProperty(
"pressed", pressed);
351 q->setAccessibleProperty(
"pressed", pressed);
364 int oldValue =
value;
376 if (
value != oldValue)
377 emit q->valueModified();
379 q->setAccessibleProperty(
"pressed",
false);
391 q->setAccessibleProperty(
"pressed",
false);
399 emit up->implicitIndicatorWidthChanged();
401 emit down->implicitIndicatorWidthChanged();
408 emit up->implicitIndicatorHeightChanged();
410 emit down->implicitIndicatorHeightChanged();
422#if QT_CONFIG(qml_locale)
440#if QT_CONFIG(qml_locale)
469 d->removeImplicitSizeListener(
d->up->indicator());
470 d->removeImplicitSizeListener(
d->down->indicator());
495 if (!
d->setValue(
d->value,
false,
false)) {
496 d->updateUpEnabled();
497 d->updateDownEnabled();
524 if (!
d->setValue(
d->value,
false,
false)) {
525 d->updateUpEnabled();
526 d->updateDownEnabled();
545 d->setValue(
value,
false,
false);
564 if (
d->stepSize == step)
591 if (
d->contentItem) {
595 d->contentItem->unsetCursor();
634 d->contentItemTextChanged();
639#if QT_CONFIG(validator)
666void QQuickSpinBox::setValidator(
QValidator *validator)
669 if (
d->validator == validator)
672 d->validator = validator;
673 emit validatorChanged();
710 if (!
d->textFromValue.isCallable()) {
715 return d->textFromValue;
722 qmlWarning(
this) <<
"textFromValue must be a callable function";
725 d->textFromValue = callback;
758 if (!
d->valueFromText.isCallable()) {
763 return d->valueFromText;
770 qmlWarning(
this) <<
"valueFromText must be a callable function";
773 d->valueFromText = callback;
831 return d->inputMethodHints;
837 if (
d->inputMethodHints == hints)
840 d->inputMethodHints = hints;
841 emit inputMethodHintsChanged();
858 return d->contentItem &&
d->contentItem->property(
"inputMethodComposing").toBool();
882 if (
d->value ==
d->from ||
d->value ==
d->to) {
883 d->updateUpEnabled();
884 d->updateDownEnabled();
907 return d->displayText;
942 if (
d->editable &&
d->contentItem && !
d->contentItem->hasActiveFocus())
943 d->contentItem->forceActiveFocus(
event->reason());
950 d->updateHover(
event->position());
958 d->updateHover(
event->position());
966 d->down->setHovered(
false);
967 d->up->setHovered(
false);
976 switch (
event->key()) {
978 if (
d->upEnabled()) {
981 d->up->setPressed(
true);
988 if (
d->downEnabled()) {
989 d->down->setPressed(
true);
1010 d->up->setPressed(
false);
1011 d->down->setPressed(
false);
1019 if (
event->timerId() ==
d->delayTimer) {
1020 d->startPressRepeat();
1021 }
else if (
event->timerId() ==
d->repeatTimer) {
1022 if (
d->up->isPressed())
1024 else if (
d->down->isPressed())
1029#if QT_CONFIG(wheelevent)
1030void QQuickSpinBox::wheelEvent(QWheelEvent *
event)
1033 QQuickControl::wheelEvent(
event);
1034 if (
d->wheelEnabled) {
1037 d->stepBy(
qRound(
d->effectiveStepSize() * delta),
true);
1061 if (!
d->setValue(
d->value,
false,
false)) {
1062 d->updateDisplayText();
1063 d->updateUpEnabled();
1064 d->updateDownEnabled();
1079 if (
QQuickTextInput *oldInput = qobject_cast<QQuickTextInput *>(oldItem)) {
1088#if QT_CONFIG(cursor)
1093 if (
QQuickTextInput *newInput = qobject_cast<QQuickTextInput *>(newItem)) {
1104 d->updateDisplayText();
1112#if QT_CONFIG(accessibility)
1113QAccessible::Role QQuickSpinBox::accessibleRole()
const
1115 return QAccessible::SpinBox;
1118void QQuickSpinBox::accessibilityActiveChanged(
bool active)
1121 QQuickControl::accessibilityActiveChanged(active);
1130#include "moc_qquickspinbox_p.cpp"
The QFocusEvent class contains event parameters for widget focus events.
QJSValue evaluate(const QString &program, const QString &fileName=QString(), int lineNumber=1, QStringList *exceptionStackTrace=nullptr)
Evaluates program, using lineNumber as the base line number, and returns the result of the evaluation...
static QJSValue fromReturnedValue(QV4::ReturnedValue d)
The QJSValue class acts as a container for Qt/JavaScript data types.
bool isCallable() const
Returns true if this QJSValue is a function, otherwise returns false.
QJSValue call(const QJSValueList &args=QJSValueList()) const
Calls this QJSValue as a function, passing args as arguments to the function, and using the globalObj...
qint32 toInt() const
Returns the signed 32-bit integer value of this QJSValue, using the conversion rules described in \l{...
QString toString() const
Returns the string value of this QJSValue, as defined in \l{ECMA-262} section 9.8,...
The QKeyEvent class describes a key event.
int toInt(const QString &s, bool *ok=nullptr) const
Returns the int represented by the localized string s.
QString toString(qlonglong i) const
Returns a localized string representation of i.
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
static bool disconnect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot)
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
virtual void timerEvent(QTimerEvent *event)
This event handler can be reimplemented in a subclass to receive timer events for the object.
QVariant property(const char *name) const
Returns the value of the object's name property.
The QPalette class contains color groups for each widget state.
\inmodule QtCore\reentrant
The QQmlContext class defines a context within a QML engine.
static QV4::ExecutionEngine * getV4Engine(QQmlEngine *e)
The QQmlEngine class provides an environment for instantiating QML components.
static void setContextForObject(QObject *, QQmlContext *)
Sets the QQmlContext for the object to context.
void itemImplicitWidthChanged(QQuickItem *item) override
virtual bool handlePress(const QPointF &point, ulong timestamp)
QQuickDeferredPointer< QQuickItem > contentItem
virtual void handleUngrab()
virtual bool handleRelease(const QPointF &point, ulong timestamp)
virtual bool handleMove(const QPointF &point, ulong timestamp)
void itemImplicitHeightChanged(QQuickItem *item) override
void focusInEvent(QFocusEvent *event) override
This event handler can be reimplemented in a subclass to receive focus-in events for an item.
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
virtual void localeChange(const QLocale &newLocale, const QLocale &oldLocale)
void classBegin() override
Invoked after class creation, but before any properties have been set.
void itemChange(ItemChange change, const ItemChangeData &value) override
Called when change occurs for this item.
bool setAccessibleProperty(const char *propertyName, const QVariant &value)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
void setFiltersChildMouseEvents(bool filter)
Sets whether pointer events intended for this item's children should be filtered through this item.
virtual void hoverEnterEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-enter events for an item.
Q_INVOKABLE QPointF mapFromItem(const QQuickItem *item, const QPointF &point) const
Maps the given point in item's coordinate system to the equivalent point within this item's coordinat...
void setFlag(Flag flag, bool enabled=true)
Enables the specified flag for this item if enabled is true; if enabled is false, the flag is disable...
virtual void keyPressEvent(QKeyEvent *event)
This event handler can be reimplemented in a subclass to receive key press events for an item.
virtual void hoverMoveEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-move events for an item.
virtual Q_INVOKABLE bool contains(const QPointF &point) const
\qmlmethod bool QtQuick::Item::contains(point point)
void setAcceptedMouseButtons(Qt::MouseButtons buttons)
Sets the mouse buttons accepted by this item to buttons.
bool isComponentComplete() const
Returns true if construction of the QML component is complete; otherwise returns false.
Q_INVOKABLE void forceActiveFocus()
\qmlmethod point QtQuick::Item::mapToItem(Item item, real x, real y) \qmlmethod point QtQuick::Item::...
virtual void keyReleaseEvent(QKeyEvent *event)
This event handler can be reimplemented in a subclass to receive key release events for an item.
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
@ ItemActiveFocusHasChanged
virtual void hoverLeaveEvent(QHoverEvent *event)
This event handler can be reimplemented in a subclass to receive hover-leave events for an item.
void setActiveFocusOnTab(bool)
Allows the user to select from a set of preset values.
void contentItemTextChanged()
void handleUngrab() override
int evaluateValueFromText(const QString &text) const
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
QQuickIndicatorButton * up
bool handlePress(const QPointF &point, ulong timestamp) override
QQuickIndicatorButton * down
bool stepBy(int steps, bool modified)
int boundValue(int value, bool wrap) const
int effectiveStepSize() const
bool setValue(int value, bool wrap, bool modified)
void itemImplicitHeightChanged(QQuickItem *item) override
QString evaluateTextFromValue(int val) const
void updateHover(const QPointF &pos)
void increase(bool modified)
QPalette defaultPalette() const override
void setDisplayText(const QString &displayText)
QQuickIndicatorButton * up
void keyPressEvent(QKeyEvent *event) override
This event handler can be reimplemented in a subclass to receive key press events for an item.
bool isInputMethodComposing() const
void setStepSize(int step)
void timerEvent(QTimerEvent *event) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
void localeChange(const QLocale &newLocale, const QLocale &oldLocale) override
void focusInEvent(QFocusEvent *event) override
This event handler can be reimplemented in a subclass to receive focus-in events for an item.
void keyReleaseEvent(QKeyEvent *event) override
This event handler can be reimplemented in a subclass to receive key release events for an item.
void setValueFromText(const QJSValue &callback)
void textFromValueChanged()
void classBegin() override
Invoked after class creation, but before any properties have been set.
bool isLive() const
\qmlproperty bool QtQuick.Controls::SpinBox::live
QQuickSpinBox(QQuickItem *parent=nullptr)
void decrease()
\qmlmethod void QtQuick.Controls::SpinBox::decrease()
Qt::InputMethodHints inputMethodHints
QQuickIndicatorButton * down
void itemChange(ItemChange change, const ItemChangeData &value) override
Called when change occurs for this item.
void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override
void hoverLeaveEvent(QHoverEvent *event) override
This event handler can be reimplemented in a subclass to receive hover-leave events for an item.
void setTextFromValue(const QJSValue &callback)
bool isEditable() const
\qmlproperty bool QtQuick.Controls::SpinBox::editable
QFont defaultFont() const override
void setEditable(bool editable)
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void hoverEnterEvent(QHoverEvent *event) override
This event handler can be reimplemented in a subclass to receive hover-enter events for an item.
void setInputMethodHints(Qt::InputMethodHints hints)
void increase()
\qmlmethod void QtQuick.Controls::SpinBox::increase()
void hoverMoveEvent(QHoverEvent *event) override
This event handler can be reimplemented in a subclass to receive hover-move events for an item.
void valueFromTextChanged()
void inputMethodComposingChanged()
static QPalette palette(Scope scope)
static QFont font(Scope scope)
\macro QT_RESTRICTED_CAST_FROM_ASCII
The QValidator class provides validation of input text.
Q_QML_PRIVATE_EXPORT QV4::ReturnedValue wrap(QV4::ExecutionEngine *engine, const QLocale &locale)
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyIsNull(qfloat16 f) noexcept
int qRound(qfloat16 d) noexcept
QList< QJSValue > QJSValueList
constexpr const T & qBound(const T &min, const T &val, const T &max)
static bool contains(const QJsonArray &haystack, unsigned needle)
GLdouble GLdouble GLdouble GLdouble q
QQmlEngine * qmlEngine(const QObject *obj)
QQmlContext * qmlContext(const QObject *obj)
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
static QT_BEGIN_NAMESPACE const int AUTO_REPEAT_DELAY
static const int AUTO_REPEAT_INTERVAL
static QT_BEGIN_NAMESPACE QAsn1Element wrap(quint8 type, const QAsn1Element &child)
#define QStringLiteral(str)
myObject disconnect()
[26]
item setCursor(Qt::IBeamCursor)
[1]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent