summaryrefslogtreecommitdiffstats
path: root/src/charts/candlestickchart/qcandlestickmodelmapper.cpp
blob: de7df613155aca72ce6086fafb39210920981e3f (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
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Charts module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:COMM$
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** $QT_END_LICENSE$
**
**
**
**
**
**
**
**
**
****************************************************************************/

#include <QtCharts/QCandlestickModelMapper>
#include <QtCharts/QCandlestickSeries>
#include <QtCharts/QCandlestickSet>
#include <QtCore/QAbstractItemModel>
#include <private/qcandlestickmodelmapper_p.h>

#include <algorithm>

QT_CHARTS_BEGIN_NAMESPACE

/*!
    \class QCandlestickModelMapper
    \since 5.8
    \inmodule QtCharts
    \brief Abstract model mapper class for candlestick series.

    Model mappers allow the use of a QAbstractItemModel-derived model as a data source for a chart
    series, creating a connection between a QCandlestickSeries and the model object. A model mapper
    maintains an equal size across all \l {QCandlestickSet} {QCandlestickSets}.

    \note The model used must support adding and removing rows/columns and modifying the data of the
    cells.
*/

/*!
    \property QCandlestickModelMapper::model
    \brief Defines the model that is used by the mapper.
*/

/*!
    \property QCandlestickModelMapper::series
    \brief Defines the QCandlestickSeries object that is used by the mapper.

    \note All data in the series is discarded when it is set to the mapper. When a new series is
    specified, the old series is disconnected (preserving its data).
*/

/*!
    \fn Qt::Orientation QCandlestickModelMapper::orientation() const
    Returns the orientation that is used when QCandlestickModelMapper accesses the model. This
    determines whether the consecutive values of the set are read from rows (Qt::Horizontal) or from
    columns (Qt::Vertical).
*/

/*!
    \fn void QCandlestickModelMapper::modelReplaced()
    \brief Emitted when the model, to which the mapper is connected, has changed.
    \sa model
*/

/*!
    \fn void QCandlestickModelMapper::seriesReplaced()
    \brief Emitted when the series to which mapper is connected to has changed.
    \sa series
*/

/*!
    Constructs a model mapper object as a child of \a parent.
*/
QCandlestickModelMapper::QCandlestickModelMapper(QObject *parent)
    : QObject(parent),
      d_ptr(new QCandlestickModelMapperPrivate(this))
{
}

void QCandlestickModelMapper::setModel(QAbstractItemModel *model)
{
    Q_D(QCandlestickModelMapper);

    if (d->m_model == model)
        return;

    if (d->m_model)
        disconnect(d->m_model, 0, d, 0);

    d->m_model = model;
    emit modelReplaced();

    if (!d->m_model)
        return;

    d->initializeCandlestickFromModel();
    // connect signals from the model
    connect(d->m_model, SIGNAL(modelReset()), d, SLOT(initializeCandlestickFromModel()));
    connect(d->m_model, SIGNAL(dataChanged(QModelIndex, QModelIndex)),
            d, SLOT(modelDataUpdated(QModelIndex, QModelIndex)));
    connect(d->m_model, SIGNAL(headerDataChanged(Qt::Orientation, int, int)),
            d, SLOT(modelHeaderDataUpdated(Qt::Orientation, int, int)));
    connect(d->m_model, SIGNAL(rowsInserted(QModelIndex, int, int)),
            d, SLOT(modelRowsInserted(QModelIndex, int, int)));
    connect(d->m_model, SIGNAL(rowsRemoved(QModelIndex, int, int)),
            d, SLOT(modelRowsRemoved(QModelIndex, int, int)));
    connect(d->m_model, SIGNAL(columnsInserted(QModelIndex, int, int)),
            d, SLOT(modelColumnsInserted(QModelIndex, int, int)));
    connect(d->m_model, SIGNAL(columnsRemoved(QModelIndex, int, int)),
            d, SLOT(modelColumnsRemoved(QModelIndex, int, int)));
    connect(d->m_model, SIGNAL(destroyed()), d, SLOT(modelDestroyed()));
}

QAbstractItemModel *QCandlestickModelMapper::model() const
{
    Q_D(const QCandlestickModelMapper);

    return d->m_model;
}

void QCandlestickModelMapper::setSeries(QCandlestickSeries *series)
{
    Q_D(QCandlestickModelMapper);

    if (d->m_series == series)
        return;

    if (d->m_series)
        disconnect(d->m_series, 0, d, 0);

    d->m_series = series;
    emit seriesReplaced();

    if (!d->m_series)
        return;

    d->initializeCandlestickFromModel();
    // connect the signals from the series
    connect(d->m_series, SIGNAL(candlestickSetsAdded(QList<QCandlestickSet *>)),
            d, SLOT(candlestickSetsAdded(QList<QCandlestickSet *>)));
    connect(d->m_series, SIGNAL(candlestickSetsRemoved(QList<QCandlestickSet*>)),
            d, SLOT(candlestickSetsRemoved(QList<QCandlestickSet *>)));
    connect(d->m_series, SIGNAL(destroyed()), d, SLOT(seriesDestroyed()));
}

QCandlestickSeries *QCandlestickModelMapper::series() const
{
    Q_D(const QCandlestickModelMapper);

    return d->m_series;
}

/*!
    Sets the row/column of the model that contains the \a timestamp values of the sets in the
    series. Default value is -1 (invalid mapping).
*/
void QCandlestickModelMapper::setTimestamp(int timestamp)
{
    Q_D(QCandlestickModelMapper);

    timestamp = qMax(timestamp, -1);

    if (d->m_timestamp == timestamp)
        return;

    d->m_timestamp = timestamp;
    emit d->timestampChanged();
    d->initializeCandlestickFromModel();
}

/*!
    Returns the row/column of the model that contains the timestamp values of the sets in the
    series. Default value is -1 (invalid mapping).
*/
int QCandlestickModelMapper::timestamp() const
{
    Q_D(const QCandlestickModelMapper);

    return d->m_timestamp;
}

/*!
    Sets the row/column of the model that contains the \a open values of the sets in the series.
    Default value is -1 (invalid mapping).
*/
void QCandlestickModelMapper::setOpen(int open)
{
    Q_D(QCandlestickModelMapper);

    open = qMax(open, -1);

    if (d->m_open == open)
        return;

    d->m_open = open;
    emit d->openChanged();
    d->initializeCandlestickFromModel();
}

/*!
    Returns the row/column of the model that contains the open values of the sets in the series.
    Default value is -1 (invalid mapping).
*/
int QCandlestickModelMapper::open() const
{
    Q_D(const QCandlestickModelMapper);

    return d->m_open;
}

/*!
    Sets the row/column of the model that contains the \a high values of the sets in the series.
    Default value is -1 (invalid mapping).
*/
void QCandlestickModelMapper::setHigh(int high)
{
    Q_D(QCandlestickModelMapper);

    high = qMax(high, -1);

    if (d->m_high == high)
        return;

    d->m_high = high;
    emit d->highChanged();
    d->initializeCandlestickFromModel();
}

/*!
    Returns the row/column of the model that contains the high values of the sets in the series.
    Default value is -1 (invalid mapping).
*/
int QCandlestickModelMapper::high() const
{
    Q_D(const QCandlestickModelMapper);

    return d->m_high;
}

/*!
    Sets the row/column of the model that contains the \a low values of the sets in the series.
    Default value is -1 (invalid mapping).
*/
void QCandlestickModelMapper::setLow(int low)
{
    Q_D(QCandlestickModelMapper);

    low = qMax(low, -1);

    if (d->m_low == low)
        return;

    d->m_low = low;
    emit d->lowChanged();
    d->initializeCandlestickFromModel();
}

/*!
    Returns the row/column of the model that contains the low values of the sets in the series.
    Default value is -1 (invalid mapping).
*/
int QCandlestickModelMapper::low() const
{
    Q_D(const QCandlestickModelMapper);

    return d->m_low;
}

/*!
    Sets the row/column of the model that contains the \a close values of the sets in the series.
    Default value is -1 (invalid mapping).
*/
void QCandlestickModelMapper::setClose(int close)
{
    Q_D(QCandlestickModelMapper);

    close = qMax(close, -1);

    if (d->m_close == close)
        return;

    d->m_close = close;
    emit d->closeChanged();
    d->initializeCandlestickFromModel();
}

/*!
    Returns the row/column of the model that contains the close values of the sets in the series.
    Default value is -1 (invalid mapping).
*/
int QCandlestickModelMapper::close() const
{
    Q_D(const QCandlestickModelMapper);

    return d->m_close;
}

/*!
    Sets the section of the model that is used as the data source for the first candlestick set.
    Parameter \a firstSetSection specifies the section of the model. Default value is -1.
*/
void QCandlestickModelMapper::setFirstSetSection(int firstSetSection)
{
    Q_D(QCandlestickModelMapper);

    firstSetSection = qMax(firstSetSection, -1);

    if (d->m_firstSetSection == firstSetSection)
        return;

    d->m_firstSetSection = firstSetSection;
    emit d->firstSetSectionChanged();
    d->initializeCandlestickFromModel();
}

/*!
    Returns the section of the model that is used as the data source for the first candlestick set.
    Default value is -1 (invalid mapping).
*/
int QCandlestickModelMapper::firstSetSection() const
{
    Q_D(const QCandlestickModelMapper);

    return d->m_firstSetSection;
}

/*!
    Sets the section of the model that is used as the data source for the last candlestick set.
    Parameter \a lastSetSection specifies the section of the model. Default value is -1.
*/
void QCandlestickModelMapper::setLastSetSection(int lastSetSection)
{
    Q_D(QCandlestickModelMapper);

    lastSetSection = qMax(lastSetSection, -1);

    if (d->m_lastSetSection == lastSetSection)
        return;

    d->m_lastSetSection = lastSetSection;
    emit d->lastSetSectionChanged();
    d->initializeCandlestickFromModel();
}

/*!
    Returns the section of the model that is used as the data source for the last candlestick set.
    Default value is -1 (invalid mapping).
*/
int QCandlestickModelMapper::lastSetSection() const
{
    Q_D(const QCandlestickModelMapper);

    return d->m_lastSetSection;
}

////////////////////////////////////////////////////////////////////////////////////////////////////

QCandlestickModelMapperPrivate::QCandlestickModelMapperPrivate(QCandlestickModelMapper *q)
    : QObject(q),
      m_model(nullptr),
      m_series(nullptr),
      m_timestamp(-1),
      m_open(-1),
      m_high(-1),
      m_low(-1),
      m_close(-1),
      m_firstSetSection(-1),
      m_lastSetSection(-1),
      m_modelSignalsBlock(false),
      m_seriesSignalsBlock(false),
      q_ptr(q)
{
}

void QCandlestickModelMapperPrivate::initializeCandlestickFromModel()
{
    if (!m_model || !m_series)
        return;

    blockSeriesSignals();
    // clear current content
    m_series->clear();
    m_sets.clear();

    // create the initial candlestick sets
    QList<QCandlestickSet *> sets;
    for (int i = m_firstSetSection; i <= m_lastSetSection; ++i) {
        QModelIndex timestampIndex = candlestickModelIndex(i, m_timestamp);
        QModelIndex openIndex = candlestickModelIndex(i, m_open);
        QModelIndex highIndex = candlestickModelIndex(i, m_high);
        QModelIndex lowIndex = candlestickModelIndex(i, m_low);
        QModelIndex closeIndex = candlestickModelIndex(i, m_close);
        if (timestampIndex.isValid()
            && openIndex.isValid()
            && highIndex.isValid()
            && lowIndex.isValid()
            && closeIndex.isValid()) {
            QCandlestickSet *set = new QCandlestickSet();
            set->setTimestamp(m_model->data(timestampIndex, Qt::DisplayRole).toReal());
            set->setOpen(m_model->data(openIndex, Qt::DisplayRole).toReal());
            set->setHigh(m_model->data(highIndex, Qt::DisplayRole).toReal());
            set->setLow(m_model->data(lowIndex, Qt::DisplayRole).toReal());
            set->setClose(m_model->data(closeIndex, Qt::DisplayRole).toReal());

            connect(set, SIGNAL(timestampChanged()), this, SLOT(candlestickSetChanged()));
            connect(set, SIGNAL(openChanged()), this, SLOT(candlestickSetChanged()));
            connect(set, SIGNAL(highChanged()), this, SLOT(candlestickSetChanged()));
            connect(set, SIGNAL(lowChanged()), this, SLOT(candlestickSetChanged()));
            connect(set, SIGNAL(closeChanged()), this, SLOT(candlestickSetChanged()));

            sets.append(set);
        } else {
            break;
        }
    }
    m_series->append(sets);
    m_sets.append(sets);
    blockSeriesSignals(false);
}

void QCandlestickModelMapperPrivate::modelDataUpdated(QModelIndex topLeft, QModelIndex bottomRight)
{
    Q_Q(QCandlestickModelMapper);

    if (!m_model || !m_series)
        return;

    if (m_modelSignalsBlock)
        return;

    blockSeriesSignals();
    QModelIndex index;
    for (int row = topLeft.row(); row <= bottomRight.row(); ++row) {
        for (int column = topLeft.column(); column <= bottomRight.column(); ++column) {
            index = topLeft.sibling(row, column);
            QCandlestickSet *set = candlestickSet(index);
            if (set) {
                int pos = (q->orientation() == Qt::Vertical) ? row : column;
                if (pos == m_timestamp)
                    set->setTimestamp(m_model->data(index).toReal());
                else if (pos == m_open)
                    set->setOpen(m_model->data(index).toReal());
                else if (pos == m_high)
                    set->setHigh(m_model->data(index).toReal());
                else if (pos == m_low)
                    set->setLow(m_model->data(index).toReal());
                else if (pos == m_close)
                    set->setClose(m_model->data(index).toReal());
            }
        }
    }
    blockSeriesSignals(false);
}

void QCandlestickModelMapperPrivate::modelHeaderDataUpdated(Qt::Orientation orientation, int first,
                                                            int last)
{
    Q_UNUSED(orientation);
    Q_UNUSED(first);
    Q_UNUSED(last);
}

void QCandlestickModelMapperPrivate::modelRowsInserted(QModelIndex parent, int start, int end)
{
    Q_UNUSED(parent)

    Q_Q(QCandlestickModelMapper);

    if (m_modelSignalsBlock)
        return;

    blockSeriesSignals();
    if (q->orientation() == Qt::Vertical)
        insertData(start, end);
    else if (start <= m_firstSetSection || start <= m_lastSetSection)
        initializeCandlestickFromModel();  // if the changes affect the map - reinitialize
    blockSeriesSignals(false);
}

void QCandlestickModelMapperPrivate::modelRowsRemoved(QModelIndex parent, int start, int end)
{
    Q_UNUSED(parent)

    Q_Q(QCandlestickModelMapper);

    if (m_modelSignalsBlock)
        return;

    blockSeriesSignals();
    if (q->orientation() == Qt::Vertical)
        removeData(start, end);
    else if (start <= m_firstSetSection || start <= m_lastSetSection)
        initializeCandlestickFromModel();  // if the changes affect the map - reinitialize
    blockSeriesSignals(false);
}

void QCandlestickModelMapperPrivate::modelColumnsInserted(QModelIndex parent, int start, int end)
{
    Q_UNUSED(parent)

    Q_Q(QCandlestickModelMapper);

    if (m_modelSignalsBlock)
        return;

    blockSeriesSignals();
    if (q->orientation() == Qt::Horizontal)
        insertData(start, end);
    else if (start <= m_firstSetSection || start <= m_lastSetSection)
        initializeCandlestickFromModel();  // if the changes affect the map - reinitialize
    blockSeriesSignals(false);
}

void QCandlestickModelMapperPrivate::modelColumnsRemoved(QModelIndex parent, int start, int end)
{
    Q_UNUSED(parent)

    Q_Q(QCandlestickModelMapper);

    if (m_modelSignalsBlock)
        return;

    blockSeriesSignals();
    if (q->orientation() == Qt::Horizontal)
        removeData(start, end);
    else if (start <= m_firstSetSection || start <= m_lastSetSection)
        initializeCandlestickFromModel();  // if the changes affect the map - reinitialize
    blockSeriesSignals(false);
}

void QCandlestickModelMapperPrivate::modelDestroyed()
{
    m_model = 0;
}

void QCandlestickModelMapperPrivate::candlestickSetsAdded(const QList<QCandlestickSet *> &sets)
{
    Q_Q(QCandlestickModelMapper);

    if (m_seriesSignalsBlock)
        return;

    if (sets.isEmpty())
        return;

    int firstIndex = m_series->sets().indexOf(sets.at(0));
    if (firstIndex == -1)
        return;

    m_lastSetSection += sets.count();

    blockModelSignals();
    if (q->orientation() == Qt::Vertical)
        m_model->insertColumns(firstIndex + m_firstSetSection, sets.count());
    else
        m_model->insertRows(firstIndex + m_firstSetSection, sets.count());

    for (int i = 0; i < sets.count(); ++i) {
        int section = i + firstIndex + m_firstSetSection;
        m_model->setData(candlestickModelIndex(section, m_timestamp), sets.at(i)->timestamp());
        m_model->setData(candlestickModelIndex(section, m_open), sets.at(i)->open());
        m_model->setData(candlestickModelIndex(section, m_high), sets.at(i)->high());
        m_model->setData(candlestickModelIndex(section, m_low), sets.at(i)->low());
        m_model->setData(candlestickModelIndex(section, m_close), sets.at(i)->close());
    }
    blockModelSignals(false);
    initializeCandlestickFromModel();
}

void QCandlestickModelMapperPrivate::candlestickSetsRemoved(const QList<QCandlestickSet *> &sets)
{
    Q_Q(QCandlestickModelMapper);

    if (m_seriesSignalsBlock)
        return;

    if (sets.isEmpty())
        return;

    QVector<int> removedIndices;
    for (auto &set : sets) {
        int index = m_sets.indexOf(set);
        if (index != -1)
            removedIndices << index;
    }

    if (removedIndices.isEmpty())
        return;

    std::sort(removedIndices.begin(), removedIndices.end());

    for (int i = removedIndices.size() - 1; i >= 0; --i) {
        m_sets.removeAt(removedIndices[i]);
        --m_lastSetSection;
    }

    blockModelSignals();

    // There is no guarantee removed sets are continuous, so remove them one by one
    for (int i = removedIndices.size() - 1; i >= 0; --i) {
        if (q->orientation() == Qt::Vertical)
            m_model->removeColumns(removedIndices[i] + m_firstSetSection, 1);
        else
            m_model->removeRows(removedIndices[i] + m_firstSetSection, 1);
    }

    blockModelSignals(false);
    initializeCandlestickFromModel();
}

void QCandlestickModelMapperPrivate::candlestickSetChanged()
{
    if (m_seriesSignalsBlock)
        return;

    QCandlestickSet *set = qobject_cast<QCandlestickSet *>(QObject::sender());
    if (!set)
        return;

    int section = m_series->sets().indexOf(set);
    if (section < 0)
        return;

    section += m_firstSetSection;

    blockModelSignals();
    m_model->setData(candlestickModelIndex(section, m_timestamp), set->timestamp());
    m_model->setData(candlestickModelIndex(section, m_open), set->open());
    m_model->setData(candlestickModelIndex(section, m_high), set->high());
    m_model->setData(candlestickModelIndex(section, m_low), set->low());
    m_model->setData(candlestickModelIndex(section, m_close), set->close());
    blockModelSignals(false);
}

void QCandlestickModelMapperPrivate::seriesDestroyed()
{
    m_series = 0;
}

QCandlestickSet *QCandlestickModelMapperPrivate::candlestickSet(QModelIndex index)
{
    Q_Q(QCandlestickModelMapper);

    if (!index.isValid())
        return 0;

    int section = (q->orientation() == Qt::Vertical) ? index.column() : index.row();
    int pos = (q->orientation() == Qt::Vertical) ? index.row() : index.column();

    if (section < m_firstSetSection || section > m_lastSetSection)
        return 0; // This part of model has not been mapped to any candlestick set.

    if (pos != m_timestamp && pos != m_open && pos != m_high && pos != m_low && pos != m_close)
        return 0; // This part of model has not been mapped to any candlestick set.

    return m_series->sets().at(section - m_firstSetSection);
}

QModelIndex QCandlestickModelMapperPrivate::candlestickModelIndex(int section, int pos)
{
    Q_Q(QCandlestickModelMapper);

    if (section < m_firstSetSection || section > m_lastSetSection)
        return QModelIndex(); // invalid

    if (pos != m_timestamp && pos != m_open && pos != m_high && pos != m_low && pos != m_close)
        return QModelIndex(); // invalid

    if (q->orientation() == Qt::Vertical)
        return m_model->index(pos, section);
    else
        return m_model->index(section, pos);
}

void QCandlestickModelMapperPrivate::insertData(int start, int end)
{
    Q_UNUSED(start)
    Q_UNUSED(end)

    // Currently candlestickchart needs to be fully recalculated when change is made.
    initializeCandlestickFromModel();
}

void QCandlestickModelMapperPrivate::removeData(int start, int end)
{
    Q_UNUSED(start)
    Q_UNUSED(end)

    // Currently candlestickchart needs to be fully recalculated when change is made.
    initializeCandlestickFromModel();
}

void QCandlestickModelMapperPrivate::blockModelSignals(bool block)
{
    m_modelSignalsBlock = block;
}

void QCandlestickModelMapperPrivate::blockSeriesSignals(bool block)
{
    m_seriesSignalsBlock = block;
}

QT_CHARTS_END_NAMESPACE

#include "moc_qcandlestickmodelmapper.cpp"
#include "moc_qcandlestickmodelmapper_p.cpp"