LimeReport/limereport/lraxisdata.h

94 lines
2.6 KiB
C
Raw Normal View History

#ifndef AXISDATA_H
#define AXISDATA_H
2022-03-09 01:44:49 +03:00
#include <QObject>
namespace LimeReport {
2022-03-09 01:44:49 +03:00
class AxisData : public QObject
{
2022-03-09 01:44:49 +03:00
Q_OBJECT
Q_PROPERTY(bool reverseDirection READ reverseDirection WRITE setReverseDirection)
Q_PROPERTY(bool calculateAxisScale READ calculateAxisScale WRITE setCalculateAxisScale)
Q_PROPERTY(bool isStepAutomatic READ isStepAutomatic WRITE setIsStepAutomatic)
Q_PROPERTY(bool isMinimumAutomatic READ isMinimumAutomatic WRITE setIsMinimumAutomatic)
Q_PROPERTY(bool isMaximumAutomatic READ isMaximumAutomatic WRITE setIsMaximumAutomatic)
Q_PROPERTY(qreal manualStep READ manualStep WRITE setManualStep)
Q_PROPERTY(qreal manualMinimum READ manualMinimum WRITE setManualMinimum)
Q_PROPERTY(qreal manualMaximum READ manualMaximum WRITE setManualMaximum)
public:
enum AxisType {
YAxis = 0,
XAxis = 1
};
AxisData(AxisType type, QObject *parent = nullptr);
2022-03-09 01:44:49 +03:00
QString toString() const;
2022-03-09 01:44:49 +03:00
void copy(AxisData *other);
void update();
void update(qreal minValue, qreal maxValue);
2022-03-10 22:35:48 +03:00
void updateForDesignMode();
int segmentCount() const;
qreal rangeMin() const;
qreal rangeMax() const;
qreal minValue() const;
qreal maxValue() const;
qreal step() const;
qreal delta() const;
2022-01-25 21:28:32 +03:00
2022-03-09 01:44:49 +03:00
bool reverseDirection() const;
void setReverseDirection(bool newReverseDirection);
bool calculateAxisScale() const;
void setCalculateAxisScale(bool newCalculateAxisScale);
qreal manualMaximum() const;
void setManualMaximum(qreal newManualMaximum);
qreal manualMinimum() const;
void setManualMinimum(qreal newManualMinimum);
qreal manualStep() const;
void setManualStep(qreal newManualStep);
bool isMaximumAutomatic() const;
void setIsMaximumAutomatic(bool newIsMaximumAutomatic);
bool isMinimumAutomatic() const;
void setIsMinimumAutomatic(bool newIsMinimumAutomatic);
bool isStepAutomatic() const;
void setIsStepAutomatic(bool newIsStepAutomatic);
AxisType type() const;
private:
2022-03-09 01:44:49 +03:00
void calculateRoundedAxisScale();
void calculateSimpleAxisScale();
qreal calculateNewMinimum(qreal min, qreal step) const;
qreal calculateNewMaximum(qreal max, qreal step) const;
qreal m_rangeMin;
qreal m_rangeMax;
qreal m_minValue;
qreal m_maxValue;
qreal m_step;
qreal m_delta;
int m_segmentCount;
2022-03-09 01:44:49 +03:00
bool m_calculateAxisScale;
bool m_reverseDirection;
qreal m_manualMaximum;
qreal m_manualMinimum;
qreal m_manualStep;
bool m_isMaximumAutomatic;
bool m_isMinimumAutomatic;
bool m_isStepAutomatic;
const AxisType m_type;
};
};
#endif // AXISDATA_H