You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.4 KiB
C++
64 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <QDateTime>
|
|
#include "ZxSubAxisX.h"
|
|
|
|
#ifdef _SCAN_OLD_CODES_
|
|
|
|
#endif
|
|
|
|
#ifdef _SCAN_OLD_CODES_
|
|
|
|
// 该类只是尝试,暂未启用
|
|
// 仅供参考
|
|
|
|
// 时间/日期格式的 X 轴
|
|
// 约定:
|
|
// - 外部 / 父类 m_dStart/m_dEnd/m_vecMainValues 单位都是"小时"
|
|
// - 不覆盖任何基类函数
|
|
// - 只提供"基准时间"和"时间快捷方法"
|
|
class I_PLOTBASE_EXPORT ZxSubAxisXDate : public ZxSubAxisX
|
|
{
|
|
Q_OBJECT
|
|
ZX_DECLARE_DYNAMIC
|
|
|
|
public:
|
|
|
|
ZxSubAxisXDate();
|
|
ZxSubAxisXDate(const QString& name);
|
|
ZxSubAxisXDate(const ZxSubAxisXDate& c);
|
|
|
|
public:
|
|
|
|
virtual void paintBack(QPainter* painter, const ZxPaintParam& param);
|
|
|
|
// 序列化
|
|
virtual void onSerialize(ZxSerializer* ser);
|
|
virtual void onDeserialize(ZxSerializer* ser);
|
|
virtual void onLoadTempl(ZxSerializer* ser);
|
|
virtual void onSaveTempl(ZxSerializer* ser);
|
|
|
|
// ===== 基准时间 =====
|
|
QDateTime getBaseDateTime() const;
|
|
void setBaseDateTime(const QDateTime& dt);
|
|
|
|
// ===== 快捷方法(内部换算成小时) =====
|
|
void setRangeByDateTime(const QDateTime& dtMin, const QDateTime& dtMax);
|
|
|
|
QDateTime getDateTimeForPos(double dPos) const;
|
|
double getPosForDateTime(const QDateTime& dt) const;
|
|
|
|
double getValueForDateTime(const QDateTime& dt) const;
|
|
QDateTime getDateTimeForValue(double dVal) const;
|
|
|
|
protected:
|
|
|
|
virtual void resetHelper();
|
|
|
|
private:
|
|
|
|
QDateTime m_dtBase;
|
|
};
|
|
|
|
#endif
|