14RangeGroup::RangeGroup(
QObject *parent)
17 connect(
this, &RangeGroup::fromChanged,
this, &RangeGroup::rangeChanged);
18 connect(
this, &RangeGroup::toChanged,
this, &RangeGroup::rangeChanged);
19 connect(
this, &RangeGroup::automaticChanged,
this, &RangeGroup::rangeChanged);
20 connect(
this, &RangeGroup::minimumChanged,
this, &RangeGroup::rangeChanged);
21 connect(
this, &RangeGroup::incrementChanged,
this, &RangeGroup::rangeChanged);
29void RangeGroup::setFrom(qreal from)
31 if (qFuzzyCompare(m_from,
from)) {
44void RangeGroup::setTo(qreal to)
46 if (qFuzzyCompare(m_to,
to)) {
59void RangeGroup::setAutomatic(
bool automatic)
79void RangeGroup::setMinimum(qreal newMinimum)
81 if (newMinimum == m_minimum) {
85 m_minimum = newMinimum;
94void RangeGroup::setIncrement(qreal newIncrement)
96 if (newIncrement == m_increment) {
100 m_increment = newIncrement;
101 Q_EMIT incrementChanged();
104bool RangeGroup::isValid()
const
106 return m_automatic || (m_to > m_from);
115 auto min = std::numeric_limits<qreal>::max();
116 auto max = std::numeric_limits<qreal>::min();
123 min = std::min(min, minimumCallback(source));
124 max = std::max(max, maximumCallback(source));
128 max = std::max(max, m_minimum);
129 if (m_increment > 0.0) {
130 max = m_increment * std::ceil(max / m_increment);
135 result.distance = max - min;
140#include "moc_RangeGroup.cpp"
Abstract base class for data sources.
qreal from
The start of this range.
qreal increment
The amount with which the range increases.
bool automatic
Whether to determine the range based on values of a chart.
qreal to
The end of this range.
qreal distance
The distance between from and to.
qreal minimum
The minimum size of the range.
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)