aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates/qquickabstractspinbox_p.h
blob: 1e47be660386f45dcd237653f96dd863c26cc7fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default

#ifndef QQUICKABSTRACTSPINBOX_P_H
#define QQUICKABSTRACTSPINBOX_P_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists purely as an
// implementation detail.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#include <private/qquickcontrol_p_p.h>
#include <private/qquickcontrol_p.h>
#include <private/qquicktheme_p.h>
#include <QtQml/qjsvalue.h>
#include <private/qquickindicatorbutton_p.h>
#include <private/qquicktextinput_p.h>
#include <private/qqmlengine_p.h>
#include <QtQml/qqmlinfo.h>
#include <QtGui/private/qlayoutpolicy_p.h>

QT_BEGIN_NAMESPACE

class QValidator;
class QQuickIndicatorButton;

template <typename Derived, typename ValueType>
class QQuickAbstractSpinBox
{
public:
    class QQuickAbstractSpinBoxPrivate : public QQuickControlPrivate
    {
    public:
        // copied from qabstractbutton.cpp
        static constexpr int AUTO_REPEAT_DELAY = 300;
        static constexpr int AUTO_REPEAT_INTERVAL = 100;

        enum ValueStatus { Modified, Unmodified };

        QQuickAbstractSpinBoxPrivate() { }

        Derived *q_func() { return static_cast<Derived *>(q_ptr); }
        const Derived *q_func() const { return static_cast<const Derived *>(q_ptr); }

        ValueType boundValue(ValueType value, bool wrap) const
        {
            bool inverted = from > to;
            if (!wrap)
                return inverted ? qBound(to, value, from) : qBound(from, value, to);

            ValueType f = inverted ? to : from;
            ValueType t = inverted ? from : to;
            if (value < f)
                value = t;
            else if (value > t)
                value = f;

            return value;
        }

        virtual bool setValue(ValueType newValue, bool wrap, ValueStatus modified) = 0;

        bool stepBy(ValueType steps, ValueStatus modified)
        {
            return setValue(value + steps, wrap, modified);
        }

        void increase(ValueStatus modified)
        {
            setValue(value + effectiveStepSize(), wrap, modified);
        }

        void decrease(ValueStatus modified)
        {
            setValue(value - effectiveStepSize(), wrap, modified);
        }

        ValueType effectiveStepSize() const { return from > to ? -1 * stepSize : stepSize; }

        virtual void updateValue() = 0;

        virtual void updateDisplayText() = 0;

        void setDisplayText(const QString &text)
        {
            if (displayText == text)
                return;

            displayText = text;
            emit q_func()->displayTextChanged();
        }

        bool upEnabled() const
        {
            const QQuickItem *upIndicator = up->indicator();
            return upIndicator && upIndicator->isEnabled();
        }

        void updateUpEnabled()
        {
            QQuickItem *upIndicator = up->indicator();
            if (!upIndicator)
                return;

            upIndicator->setEnabled(wrap || (from < to ? value < to : value > to));
        }

        bool downEnabled() const
        {
            const QQuickItem *downIndicator = down->indicator();
            return downIndicator && downIndicator->isEnabled();
        }

        void updateDownEnabled()
        {
            QQuickItem *downIndicator = down->indicator();
            if (!downIndicator)
                return;

            downIndicator->setEnabled(wrap || (from < to ? value > from : value < from));
        }

        void updateHover(const QPointF &pos)
        {
            QQuickItem *ui = up->indicator();
            QQuickItem *di = down->indicator();
            up->setHovered(ui && ui->isEnabled() && ui->contains(q_func()->mapToItem(ui, pos)));
            down->setHovered(di && di->isEnabled() && di->contains(q_func()->mapToItem(di, pos)));
        }

        void startRepeatDelay()
        {
            stopPressRepeat();
            delayTimer = q_func()->startTimer(AUTO_REPEAT_DELAY);
        }

        void startPressRepeat()
        {
            stopPressRepeat();
            repeatTimer = q_func()->startTimer(AUTO_REPEAT_INTERVAL);
        }

        void stopPressRepeat()
        {
            if (delayTimer > 0) {
                q_func()->killTimer(delayTimer);
                delayTimer = 0;
            }
            if (repeatTimer > 0) {
                q_func()->killTimer(repeatTimer);
                repeatTimer = 0;
            }
        }

        bool handlePress(const QPointF &point, ulong timestamp) override
        {
            QQuickControlPrivate::handlePress(point, timestamp);

            QQuickItem *ui = up->indicator();
            QQuickItem *di = down->indicator();
            up->setPressed(ui && ui->isEnabled() && ui->contains(ui->mapFromItem(q_func(), point)));
            down->setPressed(di && di->isEnabled()
                             && di->contains(di->mapFromItem(q_func(), point)));

            bool pressed = up->isPressed() || down->isPressed();
            q_func()->setAccessibleProperty("pressed", pressed);
            if (pressed)
                startRepeatDelay();
            return true;
        }

        bool handleMove(const QPointF &point, ulong timestamp) override
        {
            QQuickControlPrivate::handleMove(point, timestamp);
            QQuickItem *upIndicator = up->indicator();
            const bool upIndicatorContainsPoint = upIndicator && upIndicator->isEnabled()
                    && upIndicator->contains(upIndicator->mapFromItem(q_func(), point));
            up->setHovered(QQuickControlPrivate::touchId == -1 && upIndicatorContainsPoint);
            up->setPressed(upIndicatorContainsPoint);

            QQuickItem *downIndicator = down->indicator();
            const bool downIndicatorContainsPoint = downIndicator && downIndicator->isEnabled()
                    && downIndicator->contains(downIndicator->mapFromItem(q_func(), point));
            down->setHovered(QQuickControlPrivate::touchId == -1 && downIndicatorContainsPoint);
            down->setPressed(downIndicatorContainsPoint);

            bool pressed = up->isPressed() || down->isPressed();
            q_func()->setAccessibleProperty("pressed", pressed);
            if (!pressed)
                stopPressRepeat();
            return true;
        }

        bool handleRelease(const QPointF &point, ulong timestamp) override
        {
            QQuickControlPrivate::handleRelease(point, timestamp);
            QQuickItem *ui = up->indicator();
            QQuickItem *di = down->indicator();

            double oldValue = value;
            if (up->isPressed()) {
                if (repeatTimer <= 0 && ui && ui->contains(ui->mapFromItem(q_func(), point)))
                    q_func()->increase();
                // Retain pressed state until after increasing is done in case user code binds
                // stepSize to up/down.pressed.
                up->setPressed(false);
            } else if (down->isPressed()) {
                if (repeatTimer <= 0 && di && di->contains(di->mapFromItem(q_func(), point)))
                    q_func()->decrease();
                down->setPressed(false);
            }
            if (value != oldValue)
                emit q_func()->valueModified();

            q_func()->setAccessibleProperty("pressed", false);
            stopPressRepeat();
            return true;
        }

        void handleUngrab() override
        {
            QQuickControlPrivate::handleUngrab();
            up->setPressed(false);
            down->setPressed(false);

            q_func()->setAccessibleProperty("pressed", false);
            stopPressRepeat();
        }

        void itemImplicitWidthChanged(QQuickItem *item) override
        {
            QQuickControlPrivate::itemImplicitWidthChanged(item);
            if (item == up->indicator())
                emit up->implicitIndicatorWidthChanged();
            else if (item == down->indicator())
                emit down->implicitIndicatorWidthChanged();
        }

        void itemImplicitHeightChanged(QQuickItem *item) override
        {
            QQuickControlPrivate::itemImplicitHeightChanged(item);
            if (item == up->indicator())
                emit up->implicitIndicatorHeightChanged();
            else if (item == down->indicator())
                emit down->implicitIndicatorHeightChanged();
        }

        void itemDestroyed(QQuickItem *item) override
        {
            QQuickControlPrivate::itemDestroyed(item);
            if (item == up->indicator())
                up->setIndicator(nullptr);
            else if (item == down->indicator())
                down->setIndicator(nullptr);
        }

        QPalette defaultPalette() const override
        {
            return QQuickTheme::palette(QQuickTheme::SpinBox);
        }

        bool editable = false;
        bool wrap = false;
        ValueType from; // please set it in derived class constructor
        ValueType to; // please set it in derived class constructor
        ValueType value = 0;
        ValueType stepSize = 1;
        int delayTimer = 0;
        int repeatTimer = 0;
        QString displayText;
        QQuickIndicatorButton *up = nullptr;
        QQuickIndicatorButton *down = nullptr;
#if QT_CONFIG(validator)
        QValidator *validator = nullptr;
#endif
        mutable QJSValue textFromValue;
        mutable QJSValue valueFromText;
        Qt::InputMethodHints inputMethodHints = Qt::ImhDigitsOnly;
    };

public:
    ValueType from() const
    {
        auto *derived = static_cast<const Derived *>(this);
        auto *d = static_cast<const QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        return d->from;
    }

    ValueType to() const
    {
        auto *derived = static_cast<const Derived *>(this);
        auto *d = static_cast<const QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        return d->to;
    }

    ValueType value() const
    {
        auto *derived = static_cast<const Derived *>(this);
        auto *d = static_cast<const QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        return d->value;
    }

    ValueType stepSize() const
    {
        auto *derived = static_cast<const Derived *>(this);
        auto *d = static_cast<const QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        return d->stepSize;
    }

    bool isEditable() const
    {
        auto *derived = static_cast<const Derived *>(this);
        auto *d = static_cast<const QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        return d->editable;
    }

    void setEditable(bool editable)
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        if (d->editable == editable)
            return;

#if QT_CONFIG(cursor)
        if (d->contentItem) {
            if (editable)
                d->contentItem->setCursor(Qt::IBeamCursor);
            else
                d->contentItem->unsetCursor();
        }
#endif

        d->editable = editable;
        d->q_func()->setAccessibleProperty("editable", editable);
        emit derived->editableChanged();
    }

#if QT_CONFIG(validator)
    QValidator *validator() const
    {
        auto *derived = static_cast<const Derived *>(this);
        auto *d = static_cast<const QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        return d->validator;
    }

    void setValidator(QValidator *validator)
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        if (d->validator == validator)
            return;

        d->validator = validator;
        emit derived->validatorChanged();
    }
#endif

    void setTextFromValue(const QJSValue &callback)
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        if (!callback.isCallable()) {
            qmlWarning(derived) << "textFromValue must be a callable function";
            return;
        }
        d->textFromValue = callback;
        emit derived->textFromValueChanged();
    }

    void setValueFromText(const QJSValue &callback)
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        if (!callback.isCallable()) {
            qmlWarning(derived) << "valueFromText must be a callable function";
            return;
        }
        d->valueFromText = callback;
        emit derived->valueFromTextChanged();
    }

    QQuickIndicatorButton *up() const
    {
        auto *derived = static_cast<const Derived *>(this);
        auto *d = static_cast<const QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        return d->up;
    }

    QQuickIndicatorButton *down() const
    {
        auto *derived = static_cast<const Derived *>(this);
        auto *d = static_cast<const QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        return d->down;
    }

    Qt::InputMethodHints inputMethodHints() const
    {
        auto *derived = static_cast<const Derived *>(this);
        auto *d = static_cast<const QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        return d->inputMethodHints;
    }

    void setInputMethodHints(Qt::InputMethodHints hints)
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        if (d->inputMethodHints == hints)
            return;

        d->inputMethodHints = hints;
        emit derived->inputMethodHintsChanged();
    }

    bool isInputMethodComposing() const
    {
        auto *derived = static_cast<const Derived *>(this);
        auto *d = static_cast<const QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        return d->contentItem && d->contentItem->property("inputMethodComposing").toBool();
    }

    bool wrap() const
    {
        auto *derived = static_cast<const Derived *>(this);
        auto *d = static_cast<const QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        return d->wrap;
    }

    QString displayText() const
    {
        auto *derived = static_cast<const Derived *>(this);
        auto *d = static_cast<const QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        return d->displayText;
    }

public:
    void increase()
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        d->increase(QQuickAbstractSpinBoxPrivate::ValueStatus::Unmodified);
    }

    void decrease()
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        d->decrease(QQuickAbstractSpinBoxPrivate::ValueStatus::Unmodified);
    }

protected:
    void handleFocusInEvent(QFocusEvent *event)
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());

        // When an editable derived SpinBox gets focus, it must pass on the focus to its editor.
        if (d->editable && d->contentItem && !d->contentItem->hasActiveFocus())
            d->contentItem->forceActiveFocus(event->reason());
    }

    void handleHoverEnterEvent(QHoverEvent *event)
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());

        d->updateHover(event->position());
        event->ignore();
    }

    void handleHoverMoveEvent(QHoverEvent *event)
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());

        d->updateHover(event->position());
        event->ignore();
    }

    void handleHoverLeaveEvent(QHoverEvent *event)
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());

        d->down->setHovered(false);
        d->up->setHovered(false);
        event->ignore();
    }

    void handleKeyPressEvent(QKeyEvent *event)
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());

        switch (event->key()) {
        case Qt::Key_Up:
            if (d->upEnabled()) {
                // Update the pressed state before increasing/decreasing in case user code binds
                // stepSize to up/down.pressed.
                d->up->setPressed(true);
                d->increase(QQuickAbstractSpinBoxPrivate::ValueStatus::Modified);
                event->accept();
            }
            break;

        case Qt::Key_Down:
            if (d->downEnabled()) {
                d->down->setPressed(true);
                d->decrease(QQuickAbstractSpinBoxPrivate::ValueStatus::Modified);
                event->accept();
            }
            break;

        default:
            break;
        }

        d->q_func()->setAccessibleProperty("pressed", d->up->isPressed() || d->down->isPressed());
    }

    void handleKeyReleaseEvent(QKeyEvent *event)
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());

        if (d->editable && (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return))
            d->updateValue();

        d->up->setPressed(false);
        d->down->setPressed(false);
        d->q_func()->setAccessibleProperty("pressed", false);
    }

    void handleTimerEvent(QTimerEvent *event)
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());

        if (event->timerId() == d->delayTimer) {
            d->startPressRepeat();
        } else if (event->timerId() == d->repeatTimer) {
            if (d->up->isPressed())
                d->increase(QQuickAbstractSpinBoxPrivate::ValueStatus::Modified);
            else if (d->down->isPressed())
                d->decrease(QQuickAbstractSpinBoxPrivate::ValueStatus::Modified);
        }
    }

#if QT_CONFIG(wheelevent)
    void handleWheelEvent(QWheelEvent *event)
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());

        if (d->wheelEnabled) {
            const QPointF angle = event->angleDelta();
            const qreal delta = (qFuzzyIsNull(angle.y()) ? angle.x() : angle.y())
                    / int(QWheelEvent::DefaultDeltasPerStep);
            d->stepBy(d->effectiveStepSize() * delta,
                      QQuickAbstractSpinBoxPrivate::ValueStatus::Modified);
        }
    }
#endif

    void handleClassBegin()
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());

        QQmlContext *context = qmlContext(derived);
        if (context) {
            QQmlEngine::setContextForObject(d->up, context);
            QQmlEngine::setContextForObject(d->down, context);
        }
    }

    void handleComponentComplete()
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());

        QQuickIndicatorButtonPrivate::get(d->up)->executeIndicator(true);
        QQuickIndicatorButtonPrivate::get(d->down)->executeIndicator(true);

        if (!d->setValue(d->value, false /* wrap */,
                         QQuickAbstractSpinBoxPrivate::ValueStatus::Unmodified)) {
            d->updateDisplayText();
            d->updateUpEnabled();
            d->updateDownEnabled();
        }
    }

    void handleItemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        if (d->editable && change == QQuickItem::ItemActiveFocusHasChanged && !value.boolValue)
            d->updateValue();
    }

    void handleLocaleChange()
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        d->updateDisplayText();
    }

    QFont defaultFont() const { return QQuickTheme::font(QQuickTheme::SpinBox); }

#if QT_CONFIG(accessibility)
    QAccessible::Role accessibleRole() const { return QAccessible::SpinBox; }

    void handleAccessibilityActiveChanged(bool active)
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());

        if (active)
            d->q_func()->setAccessibleProperty("editable", d->editable);
    }
#endif

protected:
    QQuickAbstractSpinBox()
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        d->up = new QQuickIndicatorButton(derived);
        d->down = new QQuickIndicatorButton(derived);
        d->setSizePolicy(QLayoutPolicy::Preferred, QLayoutPolicy::Fixed);

        derived->setFlag(QQuickItem::ItemIsFocusScope);
        derived->setFiltersChildMouseEvents(true);
        derived->setAcceptedMouseButtons(Qt::LeftButton);
#if QT_CONFIG(cursor)
        derived->setCursor(Qt::ArrowCursor);
#endif
#if QT_CONFIG(quicktemplates2_multitouch)
        derived->setAcceptTouchEvents(true);
#endif
    }

    ~QQuickAbstractSpinBox()
    {
        auto *derived = static_cast<Derived *>(this);
        auto *d = static_cast<QQuickAbstractSpinBoxPrivate *>(derived->d_base_func());
        d->removeImplicitSizeListener(d->up->indicator());
        d->removeImplicitSizeListener(d->down->indicator());
    }

    // Non-copyable
    QQuickAbstractSpinBox(const QQuickAbstractSpinBox &) = delete;
    QQuickAbstractSpinBox &operator=(const QQuickAbstractSpinBox &) = delete;
};

QT_END_NAMESPACE

#endif // QQUICKABSTRACTSPINBOX_P_H