diff --git a/src/charts/candlestickchart/candlestickchartitem.cpp b/src/charts/candlestickchart/candlestickchartitem.cpp index ad64dd1..4273a82 100644 --- a/src/charts/candlestickchart/candlestickchartitem.cpp +++ b/src/charts/candlestickchart/candlestickchartitem.cpp @@ -57,7 +57,7 @@ CandlestickChartItem::CandlestickChartItem(QCandlestickSeries *series, QGraphics setZValue(ChartPresenter::CandlestickSeriesZValue); - handleCandlestickSetsAdd(m_series->candlestickSets()); + handleCandlestickSetsAdd(m_series->sets()); } CandlestickChartItem::~CandlestickChartItem() @@ -233,7 +233,7 @@ void CandlestickChartItem::handleDataStructureChanged() updateTimePeriod(); for (int i = 0; i < m_series->count(); ++i) { - QCandlestickSet *set = m_series->candlestickSets().at(i); + QCandlestickSet *set = m_series->sets().at(i); Candlestick *item = m_candlesticks.value(set); updateCandlestickGeometry(item, i); @@ -252,7 +252,7 @@ bool CandlestickChartItem::updateCandlestickGeometry(Candlestick *item, int inde { bool changed = false; - QCandlestickSet *set = m_series->candlestickSets().at(index); + QCandlestickSet *set = m_series->sets().at(index); CandlestickData &data = item->m_data; if ((data.m_open != set->open()) diff --git a/src/charts/candlestickchart/qcandlestickmodelmapper.cpp b/src/charts/candlestickchart/qcandlestickmodelmapper.cpp index a66e82a..61d61f2 100644 --- a/src/charts/candlestickchart/qcandlestickmodelmapper.cpp +++ b/src/charts/candlestickchart/qcandlestickmodelmapper.cpp @@ -310,19 +310,19 @@ int QCandlestickModelMapper::close() const /*! Sets the section of the model that is used as the data source for the first candlestick set. - Parameter \a firstCandlestickSetSection specifies the section of the model. Default value is -1. + Parameter \a firstSetSection specifies the section of the model. Default value is -1. */ -void QCandlestickModelMapper::setFirstCandlestickSetSection(int firstCandlestickSetSection) +void QCandlestickModelMapper::setFirstSetSection(int firstSetSection) { Q_D(QCandlestickModelMapper); - firstCandlestickSetSection = qMax(firstCandlestickSetSection, -1); + firstSetSection = qMax(firstSetSection, -1); - if (d->m_firstCandlestickSetSection == firstCandlestickSetSection) + if (d->m_firstSetSection == firstSetSection) return; - d->m_firstCandlestickSetSection = firstCandlestickSetSection; - emit d->firstCandlestickSetSectionChanged(); + d->m_firstSetSection = firstSetSection; + emit d->firstSetSectionChanged(); d->initializeCandlestickFromModel(); } @@ -330,28 +330,28 @@ void QCandlestickModelMapper::setFirstCandlestickSetSection(int firstCandlestick 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::firstCandlestickSetSection() const +int QCandlestickModelMapper::firstSetSection() const { Q_D(const QCandlestickModelMapper); - return d->m_firstCandlestickSetSection; + return d->m_firstSetSection; } /*! Sets the section of the model that is used as the data source for the last candlestick set. - Parameter \a lastCandlestickSetSection specifies the section of the model. Default value is -1. + Parameter \a lastSetSection specifies the section of the model. Default value is -1. */ -void QCandlestickModelMapper::setLastCandlestickSetSection(int lastCandlestickSetSection) +void QCandlestickModelMapper::setLastSetSection(int lastSetSection) { Q_D(QCandlestickModelMapper); - lastCandlestickSetSection = qMax(lastCandlestickSetSection, -1); + lastSetSection = qMax(lastSetSection, -1); - if (d->m_lastCandlestickSetSection == lastCandlestickSetSection) + if (d->m_lastSetSection == lastSetSection) return; - d->m_lastCandlestickSetSection = lastCandlestickSetSection; - emit d->lastCandlestickSetSectionChanged(); + d->m_lastSetSection = lastSetSection; + emit d->lastSetSectionChanged(); d->initializeCandlestickFromModel(); } @@ -359,11 +359,11 @@ void QCandlestickModelMapper::setLastCandlestickSetSection(int lastCandlestickSe 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::lastCandlestickSetSection() const +int QCandlestickModelMapper::lastSetSection() const { Q_D(const QCandlestickModelMapper); - return d->m_lastCandlestickSetSection; + return d->m_lastSetSection; } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -377,8 +377,8 @@ QCandlestickModelMapperPrivate::QCandlestickModelMapperPrivate(QCandlestickModel m_high(-1), m_low(-1), m_close(-1), - m_firstCandlestickSetSection(-1), - m_lastCandlestickSetSection(-1), + m_firstSetSection(-1), + m_lastSetSection(-1), m_modelSignalsBlock(false), m_seriesSignalsBlock(false), q_ptr(q) @@ -393,11 +393,11 @@ void QCandlestickModelMapperPrivate::initializeCandlestickFromModel() blockSeriesSignals(); // clear current content m_series->clear(); - m_candlestickSets.clear(); + m_sets.clear(); // create the initial candlestick sets - QList candlestickSets; - for (int i = m_firstCandlestickSetSection; i <= m_lastCandlestickSetSection; ++i) { + QList 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); @@ -421,13 +421,13 @@ void QCandlestickModelMapperPrivate::initializeCandlestickFromModel() connect(set, SIGNAL(lowChanged()), this, SLOT(candlestickSetChanged())); connect(set, SIGNAL(closeChanged()), this, SLOT(candlestickSetChanged())); - candlestickSets.append(set); + sets.append(set); } else { break; } } - m_series->append(candlestickSets); - m_candlestickSets.append(candlestickSets); + m_series->append(sets); + m_sets.append(sets); blockSeriesSignals(false); } @@ -485,7 +485,7 @@ void QCandlestickModelMapperPrivate::modelRowsInserted(QModelIndex parent, int s blockSeriesSignals(); if (q->orientation() == Qt::Vertical) insertData(start, end); - else if (start <= m_firstCandlestickSetSection || start <= m_lastCandlestickSetSection) + else if (start <= m_firstSetSection || start <= m_lastSetSection) initializeCandlestickFromModel(); // if the changes affect the map - reinitialize blockSeriesSignals(false); } @@ -502,7 +502,7 @@ void QCandlestickModelMapperPrivate::modelRowsRemoved(QModelIndex parent, int st blockSeriesSignals(); if (q->orientation() == Qt::Vertical) removeData(start, end); - else if (start <= m_firstCandlestickSetSection || start <= m_lastCandlestickSetSection) + else if (start <= m_firstSetSection || start <= m_lastSetSection) initializeCandlestickFromModel(); // if the changes affect the map - reinitialize blockSeriesSignals(false); } @@ -519,7 +519,7 @@ void QCandlestickModelMapperPrivate::modelColumnsInserted(QModelIndex parent, in blockSeriesSignals(); if (q->orientation() == Qt::Horizontal) insertData(start, end); - else if (start <= m_firstCandlestickSetSection || start <= m_lastCandlestickSetSection) + else if (start <= m_firstSetSection || start <= m_lastSetSection) initializeCandlestickFromModel(); // if the changes affect the map - reinitialize blockSeriesSignals(false); } @@ -536,7 +536,7 @@ void QCandlestickModelMapperPrivate::modelColumnsRemoved(QModelIndex parent, int blockSeriesSignals(); if (q->orientation() == Qt::Horizontal) removeData(start, end); - else if (start <= m_firstCandlestickSetSection || start <= m_lastCandlestickSetSection) + else if (start <= m_firstSetSection || start <= m_lastSetSection) initializeCandlestickFromModel(); // if the changes affect the map - reinitialize blockSeriesSignals(false); } @@ -556,20 +556,20 @@ void QCandlestickModelMapperPrivate::candlestickSetsAdded(const QListcandlestickSets().indexOf(sets.at(0)); + int firstIndex = m_series->sets().indexOf(sets.at(0)); if (firstIndex == -1) return; - m_lastCandlestickSetSection += sets.count(); + m_lastSetSection += sets.count(); blockModelSignals(); if (q->orientation() == Qt::Vertical) - m_model->insertColumns(firstIndex + m_firstCandlestickSetSection, sets.count()); + m_model->insertColumns(firstIndex + m_firstSetSection, sets.count()); else - m_model->insertRows(firstIndex + m_firstCandlestickSetSection, sets.count()); + m_model->insertRows(firstIndex + m_firstSetSection, sets.count()); for (int i = 0; i < sets.count(); ++i) { - int section = i + firstIndex + m_firstCandlestickSetSection; + 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()); @@ -590,20 +590,20 @@ void QCandlestickModelMapperPrivate::candlestickSetsRemoved(const QList= firstIndex; --i) - m_candlestickSets.removeAt(i); + m_sets.removeAt(i); blockModelSignals(); if (q->orientation() == Qt::Vertical) - m_model->removeColumns(firstIndex + m_firstCandlestickSetSection, sets.count()); + m_model->removeColumns(firstIndex + m_firstSetSection, sets.count()); else - m_model->removeRows(firstIndex + m_firstCandlestickSetSection, sets.count()); + m_model->removeRows(firstIndex + m_firstSetSection, sets.count()); blockModelSignals(false); initializeCandlestickFromModel(); } @@ -617,11 +617,11 @@ void QCandlestickModelMapperPrivate::candlestickSetChanged() if (!set) return; - int section = m_series->candlestickSets().indexOf(set); + int section = m_series->sets().indexOf(set); if (section < 0) return; - section += m_firstCandlestickSetSection; + section += m_firstSetSection; blockModelSignals(); m_model->setData(candlestickModelIndex(section, m_timestamp), set->timestamp()); @@ -647,20 +647,20 @@ QCandlestickSet *QCandlestickModelMapperPrivate::candlestickSet(QModelIndex inde int section = (q->orientation() == Qt::Vertical) ? index.column() : index.row(); int pos = (q->orientation() == Qt::Vertical) ? index.row() : index.column(); - if (section < m_firstCandlestickSetSection || section > m_lastCandlestickSetSection) + 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->candlestickSets().at(section - m_firstCandlestickSetSection); + return m_series->sets().at(section - m_firstSetSection); } QModelIndex QCandlestickModelMapperPrivate::candlestickModelIndex(int section, int pos) { Q_Q(QCandlestickModelMapper); - if (section < m_firstCandlestickSetSection || section > m_lastCandlestickSetSection) + 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) diff --git a/src/charts/candlestickchart/qcandlestickmodelmapper.h b/src/charts/candlestickchart/qcandlestickmodelmapper.h index 217468c..532c2f9 100644 --- a/src/charts/candlestickchart/qcandlestickmodelmapper.h +++ b/src/charts/candlestickchart/qcandlestickmodelmapper.h @@ -79,11 +79,11 @@ protected: void setClose(int close); int close() const; - void setFirstCandlestickSetSection(int firstCandlestickSetSection); - int firstCandlestickSetSection() const; + void setFirstSetSection(int firstSetSection); + int firstSetSection() const; - void setLastCandlestickSetSection(int lastCandlestickSetSection); - int lastCandlestickSetSection() const; + void setLastSetSection(int lastSetSection); + int lastSetSection() const; protected: QCandlestickModelMapperPrivate * const d_ptr; diff --git a/src/charts/candlestickchart/qcandlestickmodelmapper_p.h b/src/charts/candlestickchart/qcandlestickmodelmapper_p.h index df84e3f..1d04635 100644 --- a/src/charts/candlestickchart/qcandlestickmodelmapper_p.h +++ b/src/charts/candlestickchart/qcandlestickmodelmapper_p.h @@ -63,8 +63,8 @@ Q_SIGNALS: void highChanged(); void lowChanged(); void closeChanged(); - void firstCandlestickSetSectionChanged(); - void lastCandlestickSetSectionChanged(); + void firstSetSectionChanged(); + void lastSetSectionChanged(); private Q_SLOTS: void initializeCandlestickFromModel(); @@ -100,9 +100,9 @@ private: int m_high; int m_low; int m_close; - int m_firstCandlestickSetSection; - int m_lastCandlestickSetSection; - QList m_candlestickSets; + int m_firstSetSection; + int m_lastSetSection; + QList m_sets; bool m_modelSignalsBlock; bool m_seriesSignalsBlock; diff --git a/src/charts/candlestickchart/qcandlestickseries.cpp b/src/charts/candlestickchart/qcandlestickseries.cpp index 2e04d6c..986d877 100644 --- a/src/charts/candlestickchart/qcandlestickseries.cpp +++ b/src/charts/candlestickchart/qcandlestickseries.cpp @@ -602,7 +602,7 @@ void QCandlestickSeries::clear() { Q_D(QCandlestickSeries); - QList sets = candlestickSets(); + QList sets = this->sets(); bool success = d->remove(sets); if (success) { @@ -616,11 +616,11 @@ void QCandlestickSeries::clear() /*! Returns the list of sets in the series. Ownership of the sets is unchanged. */ -QList QCandlestickSeries::candlestickSets() const +QList QCandlestickSeries::sets() const { Q_D(const QCandlestickSeries); - return d->m_candlestickSets; + return d->m_sets; } /*! @@ -628,7 +628,7 @@ QList QCandlestickSeries::candlestickSets() const */ int QCandlestickSeries::count() const { - return candlestickSets().count(); + return sets().count(); } /*! @@ -918,20 +918,20 @@ void QCandlestickSeriesPrivate::initializeDomain() qreal minY(domain()->minY()); qreal maxY(domain()->maxY()); - if (m_candlestickSets.count()) { - QCandlestickSet *set = m_candlestickSets.first(); + if (m_sets.count()) { + QCandlestickSet *set = m_sets.first(); minX = set->timestamp(); maxX = set->timestamp(); minY = set->low(); maxY = set->high(); - for (int i = 1; i < m_candlestickSets.count(); ++i) { - set = m_candlestickSets.at(i); + for (int i = 1; i < m_sets.count(); ++i) { + set = m_sets.at(i); minX = qMin(minX, qreal(set->timestamp())); maxX = qMax(maxX, qreal(set->timestamp())); minY = qMin(minY, set->low()); maxY = qMax(maxY, set->high()); } - qreal extra = (maxX - minX) / m_candlestickSets.count() / 2; + qreal extra = (maxX - minX) / m_sets.count() / 2; minX = minX - extra; maxX = maxX + extra; } @@ -1039,14 +1039,14 @@ QAbstractAxis* QCandlestickSeriesPrivate::createDefaultAxis(Qt::Orientation orie bool QCandlestickSeriesPrivate::append(const QList &sets) { foreach (QCandlestickSet *set, sets) { - if ((set == 0) || m_candlestickSets.contains(set) || set->d_ptr->m_series) + if ((set == 0) || m_sets.contains(set) || set->d_ptr->m_series) return false; // Fail if any of the sets is null or is already appended. if (sets.count(set) != 1) return false; // Also fail if the same set occurs more than once in the given list. } foreach (QCandlestickSet *set, sets) { - m_candlestickSets.append(set); + m_sets.append(set); connect(set->d_func(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout())); connect(set->d_func(), SIGNAL(updatedCandlestick()), this, SIGNAL(updatedCandlesticks())); set->d_ptr->m_series = this; @@ -1061,7 +1061,7 @@ bool QCandlestickSeriesPrivate::remove(const QList &sets) return false; foreach (QCandlestickSet *set, sets) { - if ((set == 0) || (!m_candlestickSets.contains(set))) + if ((set == 0) || (!m_sets.contains(set))) return false; // Fail if any of the sets is null or is not in series. if (sets.count(set) != 1) return false; // Also fail if the same set occurs more than once in the given list. @@ -1069,7 +1069,7 @@ bool QCandlestickSeriesPrivate::remove(const QList &sets) foreach (QCandlestickSet *set, sets) { set->d_ptr->m_series = nullptr; - m_candlestickSets.removeOne(set); + m_sets.removeOne(set); disconnect(set->d_func(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout())); disconnect(set->d_func(), SIGNAL(updatedCandlestick()),this, SIGNAL(updatedCandlesticks())); } @@ -1079,10 +1079,10 @@ bool QCandlestickSeriesPrivate::remove(const QList &sets) bool QCandlestickSeriesPrivate::insert(int index, QCandlestickSet *set) { - if ((m_candlestickSets.contains(set)) || (set == 0) || set->d_ptr->m_series) + if ((m_sets.contains(set)) || (set == 0) || set->d_ptr->m_series) return false; // Fail if set is already in list or set is null. - m_candlestickSets.insert(index, set); + m_sets.insert(index, set); connect(set->d_func(), SIGNAL(updatedLayout()), this, SIGNAL(updatedLayout())); connect(set->d_func(), SIGNAL(updatedCandlestick()), this, SIGNAL(updatedCandlesticks())); set->d_ptr->m_series = this; @@ -1123,8 +1123,8 @@ void QCandlestickSeriesPrivate::populateBarCategories(QBarCategoryAxis *axis) { if (axis->categories().isEmpty()) { QStringList categories; - for (int i = 0; i < m_candlestickSets.count(); ++i) { - const qint64 timestamp = qRound64(m_candlestickSets.at(i)->timestamp()); + for (int i = 0; i < m_sets.count(); ++i) { + const qint64 timestamp = qRound64(m_sets.at(i)->timestamp()); const QString timestampFormat = m_chart->locale().dateTimeFormat(QLocale::ShortFormat); categories << QDateTime::fromMSecsSinceEpoch(timestamp).toString(timestampFormat); } diff --git a/src/charts/candlestickchart/qcandlestickseries.h b/src/charts/candlestickchart/qcandlestickseries.h index 3dea643..f96e809 100644 --- a/src/charts/candlestickchart/qcandlestickseries.h +++ b/src/charts/candlestickchart/qcandlestickseries.h @@ -64,7 +64,7 @@ public: bool take(QCandlestickSet *set); void clear(); - QList candlestickSets() const; + QList sets() const; int count() const; QAbstractSeries::SeriesType type() const; diff --git a/src/charts/candlestickchart/qcandlestickseries_p.h b/src/charts/candlestickchart/qcandlestickseries_p.h index 7ee5010..0994ffc 100644 --- a/src/charts/candlestickchart/qcandlestickseries_p.h +++ b/src/charts/candlestickchart/qcandlestickseries_p.h @@ -89,7 +89,7 @@ private: void populateBarCategories(QBarCategoryAxis *axis); protected: - QList m_candlestickSets; + QList m_sets; qreal m_maximumColumnWidth; qreal m_minimumColumnWidth; qreal m_bodyWidth; diff --git a/src/charts/candlestickchart/qhcandlestickmodelmapper.cpp b/src/charts/candlestickchart/qhcandlestickmodelmapper.cpp index b27d37d..10874b6 100644 --- a/src/charts/candlestickchart/qhcandlestickmodelmapper.cpp +++ b/src/charts/candlestickchart/qhcandlestickmodelmapper.cpp @@ -71,8 +71,8 @@ QT_CHARTS_BEGIN_NAMESPACE highColumn: 3 lowColumn: 4 closeColumn: 5 - firstCandlestickSetRow: 1 - lastCandlestickSetRow: 3 + firstSetRow: 1 + lastSetRow: 3 } } \endqml @@ -158,25 +158,25 @@ QT_CHARTS_BEGIN_NAMESPACE */ /*! - \property QHCandlestickModelMapper::firstCandlestickSetRow + \property QHCandlestickModelMapper::firstSetRow \brief Defines the row of the model that is used as the data source for the first set. Default value is -1 (invalid mapping). */ /*! - \qmlproperty int HCandlestickModelMapper::firstCandlestickSetRow + \qmlproperty int HCandlestickModelMapper::firstSetRow \brief Defines the row of the model that is used as the data source for the first set. Default value is -1 (invalid mapping). */ /*! - \property QHCandlestickModelMapper::lastCandlestickSetRow + \property QHCandlestickModelMapper::lastSetRow \brief Defines the row of the model that is used as the data source for the last set. Default value is -1 (invalid mapping). */ /*! - \qmlproperty int HCandlestickModelMapper::lastCandlestickSetRow + \qmlproperty int HCandlestickModelMapper::lastSetRow \brief Defines the row of the model that is used as the data source for the last set. Default value is -1 (invalid mapping). */ @@ -211,15 +211,15 @@ QT_CHARTS_BEGIN_NAMESPACE */ /*! - \fn void QHCandlestickModelMapper::firstCandlestickSetRowChanged() + \fn void QHCandlestickModelMapper::firstSetRowChanged() \brief Emitted when the row of the model that contains the data of the first set is changed. - \sa firstCandlestickSetRow + \sa firstSetRow */ /*! - \fn void QHCandlestickModelMapper::lastCandlestickSetRowChanged() + \fn void QHCandlestickModelMapper::lastSetRowChanged() \brief Emitted when the row of the model that contains the data of the last set is changed. - \sa lastCandlestickSetRow + \sa lastSetRow */ /*! @@ -233,10 +233,8 @@ QHCandlestickModelMapper::QHCandlestickModelMapper(QObject *parent) connect(d_ptr, SIGNAL(highChanged()), this, SIGNAL(highColumnChanged())); connect(d_ptr, SIGNAL(lowChanged()), this, SIGNAL(lowColumnChanged())); connect(d_ptr, SIGNAL(closeChanged()), this, SIGNAL(closeColumnChanged())); - connect(d_ptr, SIGNAL(firstCandlestickSetSectionChanged()), - this, SIGNAL(firstCandlestickSetRowChanged())); - connect(d_ptr, SIGNAL(lastCandlestickSetSectionChanged()), - this, SIGNAL(lastCandlestickSetRowChanged())); + connect(d_ptr, SIGNAL(firstSetSectionChanged()), this, SIGNAL(firstSetRowChanged())); + connect(d_ptr, SIGNAL(lastSetSectionChanged()), this, SIGNAL(lastSetRowChanged())); } /*! @@ -297,24 +295,24 @@ int QHCandlestickModelMapper::closeColumn() const return QCandlestickModelMapper::close(); } -void QHCandlestickModelMapper::setFirstCandlestickSetRow(int firstCandlestickSetRow) +void QHCandlestickModelMapper::setFirstSetRow(int firstSetRow) { - QCandlestickModelMapper::setFirstCandlestickSetSection(firstCandlestickSetRow); + QCandlestickModelMapper::setFirstSetSection(firstSetRow); } -int QHCandlestickModelMapper::firstCandlestickSetRow() const +int QHCandlestickModelMapper::firstSetRow() const { - return QCandlestickModelMapper::firstCandlestickSetSection(); + return QCandlestickModelMapper::firstSetSection(); } -void QHCandlestickModelMapper::setLastCandlestickSetRow(int lastCandlestickSetRow) +void QHCandlestickModelMapper::setLastSetRow(int lastSetRow) { - QCandlestickModelMapper::setLastCandlestickSetSection(lastCandlestickSetRow); + QCandlestickModelMapper::setLastSetSection(lastSetRow); } -int QHCandlestickModelMapper::lastCandlestickSetRow() const +int QHCandlestickModelMapper::lastSetRow() const { - return QCandlestickModelMapper::lastCandlestickSetSection(); + return QCandlestickModelMapper::lastSetSection(); } #include "moc_qhcandlestickmodelmapper.cpp" diff --git a/src/charts/candlestickchart/qhcandlestickmodelmapper.h b/src/charts/candlestickchart/qhcandlestickmodelmapper.h index 5bae93c..8bfa835 100644 --- a/src/charts/candlestickchart/qhcandlestickmodelmapper.h +++ b/src/charts/candlestickchart/qhcandlestickmodelmapper.h @@ -42,8 +42,8 @@ class QT_CHARTS_EXPORT QHCandlestickModelMapper : public QCandlestickModelMapper Q_PROPERTY(int highColumn READ highColumn WRITE setHighColumn NOTIFY highColumnChanged) Q_PROPERTY(int lowColumn READ lowColumn WRITE setLowColumn NOTIFY lowColumnChanged) Q_PROPERTY(int closeColumn READ closeColumn WRITE setCloseColumn NOTIFY closeColumnChanged) - Q_PROPERTY(int firstCandlestickSetRow READ firstCandlestickSetRow WRITE setFirstCandlestickSetRow NOTIFY firstCandlestickSetRowChanged) - Q_PROPERTY(int lastCandlestickSetRow READ lastCandlestickSetRow WRITE setLastCandlestickSetRow NOTIFY lastCandlestickSetRowChanged) + Q_PROPERTY(int firstSetRow READ firstSetRow WRITE setFirstSetRow NOTIFY firstSetRowChanged) + Q_PROPERTY(int lastSetRow READ lastSetRow WRITE setLastSetRow NOTIFY lastSetRowChanged) public: explicit QHCandlestickModelMapper(QObject *parent = nullptr); @@ -65,11 +65,11 @@ public: void setCloseColumn(int closeColumn); int closeColumn() const; - void setFirstCandlestickSetRow(int firstCandlestickSetRow); - int firstCandlestickSetRow() const; + void setFirstSetRow(int firstSetRow); + int firstSetRow() const; - void setLastCandlestickSetRow(int lastCandlestickSetRow); - int lastCandlestickSetRow() const; + void setLastSetRow(int lastSetRow); + int lastSetRow() const; Q_SIGNALS: void timestampColumnChanged(); @@ -77,8 +77,8 @@ Q_SIGNALS: void highColumnChanged(); void lowColumnChanged(); void closeColumnChanged(); - void firstCandlestickSetRowChanged(); - void lastCandlestickSetRowChanged(); + void firstSetRowChanged(); + void lastSetRowChanged(); }; QT_CHARTS_END_NAMESPACE diff --git a/src/charts/candlestickchart/qvcandlestickmodelmapper.cpp b/src/charts/candlestickchart/qvcandlestickmodelmapper.cpp index 990c438..42278b5 100644 --- a/src/charts/candlestickchart/qvcandlestickmodelmapper.cpp +++ b/src/charts/candlestickchart/qvcandlestickmodelmapper.cpp @@ -71,8 +71,8 @@ QT_CHARTS_BEGIN_NAMESPACE highRow: 3 lowRow: 4 closeRow: 5 - firstCandlestickSetColumn: 1 - lastCandlestickSetColumn: 3 + firstSetColumn: 1 + lastSetColumn: 3 } } \endqml @@ -158,25 +158,25 @@ QT_CHARTS_BEGIN_NAMESPACE */ /*! - \property QVCandlestickModelMapper::firstCandlestickSetColumn + \property QVCandlestickModelMapper::firstSetColumn \brief Defines the column of the model that is used as the data source for the first set. Default value is -1 (invalid mapping). */ /*! - \qmlproperty int VCandlestickModelMapper::firstCandlestickSetColumn + \qmlproperty int VCandlestickModelMapper::firstSetColumn \brief Defines the column of the model that is used as the data source for the first set. Default value is -1 (invalid mapping). */ /*! - \property QVCandlestickModelMapper::lastCandlestickSetColumn + \property QVCandlestickModelMapper::lastSetColumn \brief Defines the column of the model that is used as the data source for the last set. Default value is -1 (invalid mapping). */ /*! - \qmlproperty int VCandlestickModelMapper::lastCandlestickSetColumn + \qmlproperty int VCandlestickModelMapper::lastSetColumn \brief Defines the column of the model that is used as the data source for the last set. Default value is -1 (invalid mapping). */ @@ -212,15 +212,15 @@ QT_CHARTS_BEGIN_NAMESPACE */ /*! - \fn void QVCandlestickModelMapper::firstCandlestickSetColumnChanged() + \fn void QVCandlestickModelMapper::firstSetColumnChanged() \brief Emitted when the column of the model that contains the data of the first set is changed. - \sa firstCandlestickSetColumn + \sa firstSetColumn */ /*! - \fn void QVCandlestickModelMapper::lastCandlestickSetColumnChanged() + \fn void QVCandlestickModelMapper::lastSetColumnChanged() \brief Emitted when the column of the model that contains the data of the last set is changed. - \sa lastCandlestickSetColumn + \sa lastSetColumn */ /*! @@ -234,10 +234,8 @@ QVCandlestickModelMapper::QVCandlestickModelMapper(QObject *parent) connect(d_ptr, SIGNAL(highChanged()), this, SIGNAL(highRowChanged())); connect(d_ptr, SIGNAL(lowChanged()), this, SIGNAL(lowRowChanged())); connect(d_ptr, SIGNAL(closeChanged()), this, SIGNAL(closeRowChanged())); - connect(d_ptr, SIGNAL(firstCandlestickSetSectionChanged()), - this, SIGNAL(firstCandlestickSetColumnChanged())); - connect(d_ptr, SIGNAL(lastCandlestickSetSectionChanged()), - this, SIGNAL(lastCandlestickSetColumnChanged())); + connect(d_ptr, SIGNAL(firstSetSectionChanged()), this, SIGNAL(firstSetColumnChanged())); + connect(d_ptr, SIGNAL(lastSetSectionChanged()), this, SIGNAL(lastSetColumnChanged())); } /*! @@ -298,24 +296,24 @@ int QVCandlestickModelMapper::closeRow() const return QCandlestickModelMapper::close(); } -void QVCandlestickModelMapper::setFirstCandlestickSetColumn(int firstCandlestickSetColumn) +void QVCandlestickModelMapper::setFirstSetColumn(int firstSetColumn) { - QCandlestickModelMapper::setFirstCandlestickSetSection(firstCandlestickSetColumn); + QCandlestickModelMapper::setFirstSetSection(firstSetColumn); } -int QVCandlestickModelMapper::firstCandlestickSetColumn() const +int QVCandlestickModelMapper::firstSetColumn() const { - return QCandlestickModelMapper::firstCandlestickSetSection(); + return QCandlestickModelMapper::firstSetSection(); } -void QVCandlestickModelMapper::setLastCandlestickSetColumn(int lastCandlestickSetColumn) +void QVCandlestickModelMapper::setLastSetColumn(int lastSetColumn) { - QCandlestickModelMapper::setLastCandlestickSetSection(lastCandlestickSetColumn); + QCandlestickModelMapper::setLastSetSection(lastSetColumn); } -int QVCandlestickModelMapper::lastCandlestickSetColumn() const +int QVCandlestickModelMapper::lastSetColumn() const { - return QCandlestickModelMapper::lastCandlestickSetSection(); + return QCandlestickModelMapper::lastSetSection(); } #include "moc_qvcandlestickmodelmapper.cpp" diff --git a/src/charts/candlestickchart/qvcandlestickmodelmapper.h b/src/charts/candlestickchart/qvcandlestickmodelmapper.h index 5cd20f9..3b00747 100644 --- a/src/charts/candlestickchart/qvcandlestickmodelmapper.h +++ b/src/charts/candlestickchart/qvcandlestickmodelmapper.h @@ -42,8 +42,8 @@ class QT_CHARTS_EXPORT QVCandlestickModelMapper : public QCandlestickModelMapper Q_PROPERTY(int highRow READ highRow WRITE setHighRow NOTIFY highRowChanged) Q_PROPERTY(int lowRow READ lowRow WRITE setLowRow NOTIFY lowRowChanged) Q_PROPERTY(int closeRow READ closeRow WRITE setCloseRow NOTIFY closeRowChanged) - Q_PROPERTY(int firstCandlestickSetColumn READ firstCandlestickSetColumn WRITE setFirstCandlestickSetColumn NOTIFY firstCandlestickSetColumnChanged) - Q_PROPERTY(int lastCandlestickSetColumn READ lastCandlestickSetColumn WRITE setLastCandlestickSetColumn NOTIFY lastCandlestickSetColumnChanged) + Q_PROPERTY(int firstSetColumn READ firstSetColumn WRITE setFirstSetColumn NOTIFY firstSetColumnChanged) + Q_PROPERTY(int lastSetColumn READ lastSetColumn WRITE setLastSetColumn NOTIFY lastSetColumnChanged) public: explicit QVCandlestickModelMapper(QObject *parent = nullptr); @@ -65,11 +65,11 @@ public: void setCloseRow(int closeRow); int closeRow() const; - void setFirstCandlestickSetColumn(int firstCandlestickSetColumn); - int firstCandlestickSetColumn() const; + void setFirstSetColumn(int firstSetColumn); + int firstSetColumn() const; - void setLastCandlestickSetColumn(int lastCandlestickSetColumn); - int lastCandlestickSetColumn() const; + void setLastSetColumn(int lastSetColumn); + int lastSetColumn() const; Q_SIGNALS: void timestampRowChanged(); @@ -77,8 +77,8 @@ Q_SIGNALS: void highRowChanged(); void lowRowChanged(); void closeRowChanged(); - void firstCandlestickSetColumnChanged(); - void lastCandlestickSetColumnChanged(); + void firstSetColumnChanged(); + void lastSetColumnChanged(); }; QT_CHARTS_END_NAMESPACE diff --git a/src/chartsqml2/declarativecandlestickseries.cpp b/src/chartsqml2/declarativecandlestickseries.cpp index 6981e85..66e6cdb 100644 --- a/src/chartsqml2/declarativecandlestickseries.cpp +++ b/src/chartsqml2/declarativecandlestickseries.cpp @@ -126,7 +126,7 @@ QString DeclarativeCandlestickSeries::brushFilename() const DeclarativeCandlestickSet *DeclarativeCandlestickSeries::at(int index) { - QList sets = candlestickSets(); + QList sets = this->sets(); if (index >= 0 && index < sets.count()) return qobject_cast(sets[index]); @@ -158,7 +158,7 @@ bool DeclarativeCandlestickSeries::append(qreal open, qreal high, qreal low, qre bool DeclarativeCandlestickSeries::remove(qreal timestamp) { for (int i = 0; i < count(); ++i) { - QCandlestickSet *set = candlestickSets().at(i); + QCandlestickSet *set = sets().at(i); if (set->timestamp() == timestamp) return QCandlestickSeries::remove(set); } diff --git a/tests/auto/qcandlestickmodelmapper/tst_qcandlestickmodelmapper.cpp b/tests/auto/qcandlestickmodelmapper/tst_qcandlestickmodelmapper.cpp index b6110c7..3295911 100644 --- a/tests/auto/qcandlestickmodelmapper/tst_qcandlestickmodelmapper.cpp +++ b/tests/auto/qcandlestickmodelmapper/tst_qcandlestickmodelmapper.cpp @@ -110,8 +110,8 @@ void tst_qcandlestickmodelmapper::createHorizontalMapper() m_hMapper->setHighColumn(3); m_hMapper->setLowColumn(5); m_hMapper->setCloseColumn(6); - m_hMapper->setFirstCandlestickSetRow(0); - m_hMapper->setLastCandlestickSetRow(4); + m_hMapper->setFirstSetRow(0); + m_hMapper->setLastSetRow(4); m_hMapper->setModel(m_model); m_hMapper->setSeries(m_series); } @@ -125,8 +125,8 @@ void tst_qcandlestickmodelmapper::createVerticalMapper() m_vMapper->setHighRow(3); m_vMapper->setLowRow(5); m_vMapper->setCloseRow(6); - m_vMapper->setFirstCandlestickSetColumn(0); - m_vMapper->setLastCandlestickSetColumn(4); + m_vMapper->setFirstSetColumn(0); + m_vMapper->setLastSetColumn(4); m_vMapper->setModel(m_model); m_vMapper->setSeries(m_series); } @@ -179,9 +179,9 @@ void tst_qcandlestickmodelmapper::cleanup() void tst_qcandlestickmodelmapper::verticalMapper_data() { - QTest::addColumn("firstCandlestickSetColumn"); - QTest::addColumn("lastCandlestickSetColumn"); - QTest::addColumn("expectedCandlestickSetCount"); + QTest::addColumn("firstSetColumn"); + QTest::addColumn("lastSetColumn"); + QTest::addColumn("expectedSetCount"); QTest::newRow("last column greater than first column") << 0 << 1 << 2; QTest::newRow("last column equal to first column") << 1 << 1 << 1; @@ -193,21 +193,21 @@ void tst_qcandlestickmodelmapper::verticalMapper_data() void tst_qcandlestickmodelmapper::verticalMapper() { - QFETCH(int, firstCandlestickSetColumn); - QFETCH(int, lastCandlestickSetColumn); - QFETCH(int, expectedCandlestickSetCount); + QFETCH(int, firstSetColumn); + QFETCH(int, lastSetColumn); + QFETCH(int, expectedSetCount); QCandlestickSeries *series = new QCandlestickSeries(); m_chart->addSeries(series); createVerticalMapper(); - m_vMapper->setFirstCandlestickSetColumn(firstCandlestickSetColumn); - m_vMapper->setLastCandlestickSetColumn(lastCandlestickSetColumn); + m_vMapper->setFirstSetColumn(firstSetColumn); + m_vMapper->setLastSetColumn(lastSetColumn); m_vMapper->setSeries(series); - QCOMPARE(m_vMapper->firstCandlestickSetColumn(), qMax(firstCandlestickSetColumn, -1)); - QCOMPARE(m_vMapper->lastCandlestickSetColumn(), qMax(lastCandlestickSetColumn, -1)); - QCOMPARE(series->count(), expectedCandlestickSetCount); + QCOMPARE(m_vMapper->firstSetColumn(), qMax(firstSetColumn, -1)); + QCOMPARE(m_vMapper->lastSetColumn(), qMax(lastSetColumn, -1)); + QCOMPARE(series->count(), expectedSetCount); m_chart->removeSeries(series); delete series; @@ -272,14 +272,14 @@ void tst_qcandlestickmodelmapper::verticalMapperCustomMapping() && (m_vMapper->highRow() >= 0 && m_vMapper->highRow() < m_modelRowCount) && (m_vMapper->lowRow() >= 0 && m_vMapper->lowRow() < m_modelRowCount) && (m_vMapper->closeRow() >= 0 && m_vMapper->closeRow() < m_modelRowCount)) - count = m_vMapper->lastCandlestickSetColumn() - m_vMapper->firstCandlestickSetColumn() + 1; + count = m_vMapper->lastSetColumn() - m_vMapper->firstSetColumn() + 1; else count = 0; QCOMPARE(series->count(), count); // change values column mapping to invalid - m_vMapper->setFirstCandlestickSetColumn(-1); - m_vMapper->setLastCandlestickSetColumn(1); + m_vMapper->setFirstSetColumn(-1); + m_vMapper->setLastSetColumn(1); QCOMPARE(series->count(), 0); m_chart->removeSeries(series); @@ -288,9 +288,9 @@ void tst_qcandlestickmodelmapper::verticalMapperCustomMapping() void tst_qcandlestickmodelmapper::horizontalMapper_data() { - QTest::addColumn("firstCandlestickSetRow"); - QTest::addColumn("lastCandlestickSetRow"); - QTest::addColumn("expectedCandlestickSetCount"); + QTest::addColumn("firstSetRow"); + QTest::addColumn("lastSetRow"); + QTest::addColumn("expectedSetCount"); QTest::newRow("last row greater than first row") << 0 << 1 << 2; QTest::newRow("last row equal to first row") << 1 << 1 << 1; @@ -302,21 +302,21 @@ void tst_qcandlestickmodelmapper::horizontalMapper_data() void tst_qcandlestickmodelmapper::horizontalMapper() { - QFETCH(int, firstCandlestickSetRow); - QFETCH(int, lastCandlestickSetRow); - QFETCH(int, expectedCandlestickSetCount); + QFETCH(int, firstSetRow); + QFETCH(int, lastSetRow); + QFETCH(int, expectedSetCount); QCandlestickSeries *series = new QCandlestickSeries(); m_chart->addSeries(series); createHorizontalMapper(); - m_hMapper->setFirstCandlestickSetRow(firstCandlestickSetRow); - m_hMapper->setLastCandlestickSetRow(lastCandlestickSetRow); + m_hMapper->setFirstSetRow(firstSetRow); + m_hMapper->setLastSetRow(lastSetRow); m_hMapper->setSeries(series); - QCOMPARE(m_hMapper->firstCandlestickSetRow(), qMax(firstCandlestickSetRow, -1)); - QCOMPARE(m_hMapper->lastCandlestickSetRow(), qMax(lastCandlestickSetRow, -1)); - QCOMPARE(series->count(), expectedCandlestickSetCount); + QCOMPARE(m_hMapper->firstSetRow(), qMax(firstSetRow, -1)); + QCOMPARE(m_hMapper->lastSetRow(), qMax(lastSetRow, -1)); + QCOMPARE(series->count(), expectedSetCount); m_chart->removeSeries(series); delete series; @@ -381,14 +381,14 @@ void tst_qcandlestickmodelmapper::horizontalMapperCustomMapping() && (m_hMapper->highColumn() >= 0 && m_hMapper->highColumn() < m_modelColumnCount) && (m_hMapper->lowColumn() >= 0 && m_hMapper->lowColumn() < m_modelColumnCount) && (m_hMapper->closeColumn() >= 0 && m_hMapper->closeColumn() < m_modelColumnCount)) - count = m_hMapper->lastCandlestickSetRow() - m_hMapper->firstCandlestickSetRow() + 1; + count = m_hMapper->lastSetRow() - m_hMapper->firstSetRow() + 1; else count = 0; QCOMPARE(series->count(), count); // change values row mapping to invalid - m_hMapper->setFirstCandlestickSetRow(-1); - m_hMapper->setLastCandlestickSetRow(1); + m_hMapper->setFirstSetRow(-1); + m_hMapper->setLastSetRow(1); QCOMPARE(series->count(), 0); m_chart->removeSeries(series); @@ -400,7 +400,7 @@ void tst_qcandlestickmodelmapper::seriesUpdated() createVerticalMapper(); QVERIFY(m_vMapper->model() != nullptr); - QCandlestickSet *set = m_series->candlestickSets().value(0, 0); + QCandlestickSet *set = m_series->sets().value(0, 0); QVERIFY(set != nullptr); // update values @@ -429,8 +429,8 @@ void tst_qcandlestickmodelmapper::seriesUpdated() // remove sets newCandlestickSets.clear(); - newCandlestickSets << m_series->candlestickSets().at(m_series->count() - 1); - newCandlestickSets << m_series->candlestickSets().at(m_series->count() - 2); + newCandlestickSets << m_series->sets().at(m_series->count() - 1); + newCandlestickSets << m_series->sets().at(m_series->count() - 2); m_series->remove(newCandlestickSets); QCOMPARE(m_model->columnCount(), m_modelColumnCount); } @@ -438,7 +438,7 @@ void tst_qcandlestickmodelmapper::seriesUpdated() void tst_qcandlestickmodelmapper::verticalModelInsertRows() { createVerticalMapper(); - int count = m_vMapper->lastCandlestickSetColumn() - m_vMapper->firstCandlestickSetColumn() + 1; + int count = m_vMapper->lastSetColumn() - m_vMapper->firstSetColumn() + 1; QVERIFY(m_vMapper->model() != 0); QCOMPARE(m_series->count(), count); @@ -449,7 +449,7 @@ void tst_qcandlestickmodelmapper::verticalModelInsertRows() void tst_qcandlestickmodelmapper::verticalModelRemoveRows() { createVerticalMapper(); - int count = m_vMapper->lastCandlestickSetColumn() - m_vMapper->firstCandlestickSetColumn() + 1; + int count = m_vMapper->lastSetColumn() - m_vMapper->firstSetColumn() + 1; QVERIFY(m_vMapper->model() != 0); QCOMPARE(m_series->count(), count); @@ -464,7 +464,7 @@ void tst_qcandlestickmodelmapper::verticalModelRemoveRows() void tst_qcandlestickmodelmapper::verticalModelInsertColumns() { createVerticalMapper(); - int count = m_vMapper->lastCandlestickSetColumn() - m_vMapper->firstCandlestickSetColumn() + 1; + int count = m_vMapper->lastSetColumn() - m_vMapper->firstSetColumn() + 1; QVERIFY(m_vMapper->model() != 0); QCOMPARE(m_series->count(), count); @@ -475,7 +475,7 @@ void tst_qcandlestickmodelmapper::verticalModelInsertColumns() void tst_qcandlestickmodelmapper::verticalModelRemoveColumns() { createVerticalMapper(); - int count = m_vMapper->lastCandlestickSetColumn() - m_vMapper->firstCandlestickSetColumn() + 1; + int count = m_vMapper->lastSetColumn() - m_vMapper->firstSetColumn() + 1; QVERIFY(m_vMapper->model() != 0); QCOMPARE(m_series->count(), count); @@ -491,7 +491,7 @@ void tst_qcandlestickmodelmapper::verticalModelRemoveColumns() void tst_qcandlestickmodelmapper::horizontalModelInsertRows() { createHorizontalMapper(); - int count = m_hMapper->lastCandlestickSetRow() - m_hMapper->firstCandlestickSetRow() + 1; + int count = m_hMapper->lastSetRow() - m_hMapper->firstSetRow() + 1; QVERIFY(m_hMapper->model() != 0); QCOMPARE(m_series->count(), count); @@ -502,7 +502,7 @@ void tst_qcandlestickmodelmapper::horizontalModelInsertRows() void tst_qcandlestickmodelmapper::horizontalModelRemoveRows() { createHorizontalMapper(); - int count = m_hMapper->lastCandlestickSetRow() - m_hMapper->firstCandlestickSetRow() + 1; + int count = m_hMapper->lastSetRow() - m_hMapper->firstSetRow() + 1; QVERIFY(m_hMapper->model() != 0); QCOMPARE(m_series->count(), qMin(m_model->rowCount(), count)); @@ -518,7 +518,7 @@ void tst_qcandlestickmodelmapper::horizontalModelRemoveRows() void tst_qcandlestickmodelmapper::horizontalModelInsertColumns() { createHorizontalMapper(); - int count = m_hMapper->lastCandlestickSetRow() - m_hMapper->firstCandlestickSetRow() + 1; + int count = m_hMapper->lastSetRow() - m_hMapper->firstSetRow() + 1; QVERIFY(m_hMapper->model() != 0); QCOMPARE(m_series->count(), count); @@ -529,7 +529,7 @@ void tst_qcandlestickmodelmapper::horizontalModelInsertColumns() void tst_qcandlestickmodelmapper::horizontalModelRemoveColumns() { createHorizontalMapper(); - int count = m_hMapper->lastCandlestickSetRow() - m_hMapper->firstCandlestickSetRow() + 1; + int count = m_hMapper->lastSetRow() - m_hMapper->firstSetRow() + 1; QVERIFY(m_hMapper->model() != 0); QCOMPARE(m_series->count(), count); @@ -550,7 +550,7 @@ void tst_qcandlestickmodelmapper::modelUpdateCell() qreal newValue = 44.0; QVERIFY(m_model->setData(index, newValue)); QCOMPARE(m_model->data(index).toReal(), newValue); - QCOMPARE(m_series->candlestickSets().at(index.row())->timestamp(), newValue); + QCOMPARE(m_series->sets().at(index.row())->timestamp(), newValue); } void tst_qcandlestickmodelmapper::verticalMapperSignals() @@ -564,8 +564,8 @@ void tst_qcandlestickmodelmapper::verticalMapperSignals() QSignalSpy spy4(mapper, SIGNAL(highRowChanged())); QSignalSpy spy5(mapper, SIGNAL(lowRowChanged())); QSignalSpy spy6(mapper, SIGNAL(closeRowChanged())); - QSignalSpy spy7(mapper, SIGNAL(firstCandlestickSetColumnChanged())); - QSignalSpy spy8(mapper, SIGNAL(lastCandlestickSetColumnChanged())); + QSignalSpy spy7(mapper, SIGNAL(firstSetColumnChanged())); + QSignalSpy spy8(mapper, SIGNAL(lastSetColumnChanged())); mapper->setModel(m_model); mapper->setSeries(m_series); @@ -574,8 +574,8 @@ void tst_qcandlestickmodelmapper::verticalMapperSignals() mapper->setHighRow(3); mapper->setLowRow(4); mapper->setCloseRow(5); - mapper->setFirstCandlestickSetColumn(0); - mapper->setLastCandlestickSetColumn(1); + mapper->setFirstSetColumn(0); + mapper->setLastSetColumn(1); QCOMPARE(spy0.count(), 1); QCOMPARE(spy1.count(), 1); @@ -601,8 +601,8 @@ void tst_qcandlestickmodelmapper::horizontalMapperSignals() QSignalSpy spy4(mapper, SIGNAL(highColumnChanged())); QSignalSpy spy5(mapper, SIGNAL(lowColumnChanged())); QSignalSpy spy6(mapper, SIGNAL(closeColumnChanged())); - QSignalSpy spy7(mapper, SIGNAL(firstCandlestickSetRowChanged())); - QSignalSpy spy8(mapper, SIGNAL(lastCandlestickSetRowChanged())); + QSignalSpy spy7(mapper, SIGNAL(firstSetRowChanged())); + QSignalSpy spy8(mapper, SIGNAL(lastSetRowChanged())); mapper->setModel(m_model); mapper->setSeries(m_series); @@ -611,8 +611,8 @@ void tst_qcandlestickmodelmapper::horizontalMapperSignals() mapper->setHighColumn(3); mapper->setLowColumn(4); mapper->setCloseColumn(5); - mapper->setFirstCandlestickSetRow(0); - mapper->setLastCandlestickSetRow(1); + mapper->setFirstSetRow(0); + mapper->setLastSetRow(1); QCOMPARE(spy0.count(), 1); QCOMPARE(spy1.count(), 1); diff --git a/tests/auto/qcandlestickseries/tst_qcandlestickseries.cpp b/tests/auto/qcandlestickseries/tst_qcandlestickseries.cpp index 61201bf..89686a6 100644 --- a/tests/auto/qcandlestickseries/tst_qcandlestickseries.cpp +++ b/tests/auto/qcandlestickseries/tst_qcandlestickseries.cpp @@ -57,7 +57,7 @@ private Q_SLOTS: void insert(); void take(); void clear(); - void candlestickSets(); + void sets(); void count(); void type(); void maximumColumnWidth_data(); @@ -182,7 +182,7 @@ void tst_QCandlestickSeries::remove() QCOMPARE(m_series->count(), m_sets.count() - removeCount); for (int i = removeCount; i < m_sets.count(); ++i) - QCOMPARE(m_series->candlestickSets().at(i - removeCount), m_sets.at(i)); + QCOMPARE(m_series->sets().at(i - removeCount), m_sets.at(i)); // Try removing all sets again (should be ok, even if some sets have already been removed) for (int i = 0; i < m_sets.count(); ++i) @@ -313,23 +313,23 @@ void tst_QCandlestickSeries::clear() QCOMPARE(m_series->count(), 0); } -void tst_QCandlestickSeries::candlestickSets() +void tst_QCandlestickSeries::sets() { m_series->append(m_sets); - QCOMPARE(m_series->candlestickSets(), m_sets); + QCOMPARE(m_series->sets(), m_sets); for (int i = 0; i < m_sets.count(); ++i) - QCOMPARE(m_series->candlestickSets().at(i), m_sets.at(i)); + QCOMPARE(m_series->sets().at(i), m_sets.at(i)); m_series->clear(); - QCOMPARE(m_series->candlestickSets(), QList()); + QCOMPARE(m_series->sets(), QList()); } void tst_QCandlestickSeries::count() { m_series->append(m_sets); QCOMPARE(m_series->count(), m_sets.count()); - QCOMPARE(m_series->count(), m_series->candlestickSets().count()); + QCOMPARE(m_series->count(), m_series->sets().count()); } void tst_QCandlestickSeries::type() @@ -586,8 +586,8 @@ void tst_QCandlestickSeries::mouseClicked() QVERIFY(m_series->append(m_sets)); QCOMPARE(m_series->count(), m_sets.count()); - QCandlestickSet *set1 = m_series->candlestickSets().at(1); - QCandlestickSet *set2 = m_series->candlestickSets().at(2); + QCandlestickSet *set1 = m_series->sets().at(1); + QCandlestickSet *set2 = m_series->sets().at(2); QSignalSpy seriesSpy(m_series, SIGNAL(clicked(QCandlestickSet *))); QSignalSpy setSpy1(set1, SIGNAL(clicked())); @@ -649,8 +649,8 @@ void tst_QCandlestickSeries::mouseHovered() QVERIFY(m_series->append(m_sets)); QCOMPARE(m_series->count(), m_sets.count()); - QCandlestickSet *set1 = m_series->candlestickSets().at(1); - QCandlestickSet *set2 = m_series->candlestickSets().at(2); + QCandlestickSet *set1 = m_series->sets().at(1); + QCandlestickSet *set2 = m_series->sets().at(2); QSignalSpy seriesSpy(m_series, SIGNAL(hovered(bool, QCandlestickSet *))); QSignalSpy setSpy1(set1, SIGNAL(hovered(bool))); @@ -764,8 +764,8 @@ void tst_QCandlestickSeries::mousePressed() QVERIFY(m_series->append(m_sets)); QCOMPARE(m_series->count(), m_sets.count()); - QCandlestickSet *set1 = m_series->candlestickSets().at(1); - QCandlestickSet *set2 = m_series->candlestickSets().at(2); + QCandlestickSet *set1 = m_series->sets().at(1); + QCandlestickSet *set2 = m_series->sets().at(2); QSignalSpy seriesSpy(m_series, SIGNAL(pressed(QCandlestickSet *))); QSignalSpy setSpy1(set1, SIGNAL(pressed())); @@ -827,8 +827,8 @@ void tst_QCandlestickSeries::mouseReleased() QVERIFY(m_series->append(m_sets)); QCOMPARE(m_series->count(), m_sets.count()); - QCandlestickSet *set1 = m_series->candlestickSets().at(1); - QCandlestickSet *set2 = m_series->candlestickSets().at(2); + QCandlestickSet *set1 = m_series->sets().at(1); + QCandlestickSet *set2 = m_series->sets().at(2); QSignalSpy seriesSpy(m_series, SIGNAL(released(QCandlestickSet *))); QSignalSpy setSpy1(set1, SIGNAL(released())); @@ -890,8 +890,8 @@ void tst_QCandlestickSeries::mouseDoubleClicked() QVERIFY(m_series->append(m_sets)); QCOMPARE(m_series->count(), m_sets.count()); - QCandlestickSet *set1 = m_series->candlestickSets().at(1); - QCandlestickSet *set2 = m_series->candlestickSets().at(2); + QCandlestickSet *set1 = m_series->sets().at(1); + QCandlestickSet *set2 = m_series->sets().at(2); QSignalSpy seriesSpy(m_series, SIGNAL(doubleClicked(QCandlestickSet *))); QSignalSpy setSpy1(set1, SIGNAL(doubleClicked())); diff --git a/tests/manual/candlesticktester/mainwidget.cpp b/tests/manual/candlesticktester/mainwidget.cpp index 7364f02..9c902a3 100644 --- a/tests/manual/candlesticktester/mainwidget.cpp +++ b/tests/manual/candlesticktester/mainwidget.cpp @@ -311,17 +311,17 @@ void MainWidget::updateAxes() series = nullptr; m_axisX = m_chart->axes(Qt::Horizontal).first(); - if (series && !series->candlestickSets().isEmpty()) { + if (series && !series->sets().isEmpty()) { if (m_axisX->type() == QAbstractAxis::AxisTypeBarCategory) { QBarCategoryAxis *axisX = qobject_cast(m_axisX); QStringList categories; - for (int i = 0; i < series->candlestickSets().count(); ++i) + for (int i = 0; i < series->sets().count(); ++i) categories.append(QString::number(i)); axisX->setCategories(categories); } else { // QAbstractAxis::AxisTypeDateTime || QAbstractAxis::AxisTypeValue qreal msInMonth = 31.0 * 24.0 * 60.0 * 60.0 * 1000.0; - qreal min = series->candlestickSets().first()->timestamp() - msInMonth; - qreal max = series->candlestickSets().last()->timestamp() + msInMonth; + qreal min = series->sets().first()->timestamp() - msInMonth; + qreal max = series->sets().last()->timestamp() + msInMonth; QDateTime minDateTime = QDateTime::fromMSecsSinceEpoch(min); QDateTime maxDateTime = QDateTime::fromMSecsSinceEpoch(max); @@ -369,8 +369,8 @@ void MainWidget::addSeries() } } else { QCandlestickSeries *s = qobject_cast(m_chart->series().at(0)); - for (int i = 0; i < s->candlestickSets().count(); ++i) { - QCandlestickSet *set = randomSet(s->candlestickSets().at(i)->timestamp()); + for (int i = 0; i < s->sets().count(); ++i) { + QCandlestickSet *set = randomSet(s->sets().at(i)->timestamp()); series->append(set); } } @@ -424,7 +424,7 @@ void MainWidget::addSet() QDateTime dateTime; if (series->count()) { - dateTime.setMSecsSinceEpoch(series->candlestickSets().last()->timestamp()); + dateTime.setMSecsSinceEpoch(series->sets().last()->timestamp()); dateTime = dateTime.addMonths(1); } else { dateTime.setDate(QDate(QDateTime::currentDateTime().date().year(), 1, 1)); @@ -450,7 +450,7 @@ void MainWidget::insertSet() QDateTime dateTime; if (series->count()) { - dateTime.setMSecsSinceEpoch(series->candlestickSets().first()->timestamp()); + dateTime.setMSecsSinceEpoch(series->sets().first()->timestamp()); dateTime = dateTime.addMonths(-1); } else { dateTime.setDate(QDate(QDateTime::currentDateTime().date().year(), 1, 1)); @@ -473,10 +473,10 @@ void MainWidget::removeSet() foreach (QAbstractSeries *s, m_chart->series()) { QCandlestickSeries *series = qobject_cast(s); - if (series->candlestickSets().isEmpty()) + if (series->sets().isEmpty()) qDebug() << "Create a set first"; else - series->remove(series->candlestickSets().last()); + series->remove(series->sets().last()); } updateAxes(); @@ -491,7 +491,7 @@ void MainWidget::removeAllSets() foreach (QAbstractSeries *s, m_chart->series()) { QCandlestickSeries *series = qobject_cast(s); - if (series->candlestickSets().isEmpty()) + if (series->sets().isEmpty()) qDebug() << "Create a set first"; else series->clear(); @@ -665,11 +665,11 @@ void MainWidget::attachModelMapper() series->setName(QStringLiteral("SWMM")); // Series With Model Mapper CustomTableModel *model = qobject_cast(m_hModelMapper->model()); - foreach (QCandlestickSet *set, series->candlestickSets()) + foreach (QCandlestickSet *set, series->sets()) model->addRow(set); - m_hModelMapper->setFirstCandlestickSetRow(0); - m_hModelMapper->setLastCandlestickSetRow(model->rowCount() - 1); + m_hModelMapper->setFirstSetRow(0); + m_hModelMapper->setLastSetRow(model->rowCount() - 1); m_hModelMapper->setSeries(series); } @@ -683,8 +683,8 @@ void MainWidget::detachModelMapper() series->setName(QStringLiteral("S1")); m_hModelMapper->setSeries(nullptr); - m_hModelMapper->setFirstCandlestickSetRow(-1); - m_hModelMapper->setLastCandlestickSetRow(-1); + m_hModelMapper->setFirstSetRow(-1); + m_hModelMapper->setLastSetRow(-1); CustomTableModel *model = qobject_cast(m_hModelMapper->model()); model->clearRows();