45 lines
1.3 KiB
C++
45 lines
1.3 KiB
C++
#pragma once
|
|
#include "Abs_Axis.h"
|
|
namespace YSG {
|
|
struct Time_Axis_Private;
|
|
struct Time_Ticker;
|
|
/// 时间轴,输入 tick 后按格式显示时间标签。
|
|
class LIB_DECL Time_Axis : public Abs_Axis {
|
|
public:
|
|
/// 返回私有渲染数据。
|
|
Time_Axis_Private* d();
|
|
Render_Data* create_render_data() override;
|
|
Render_State* create_render_state() override;
|
|
Input_Data* create_input_data() override;
|
|
protected:
|
|
Time_Axis();
|
|
public:
|
|
PROP(int, time_point_size)
|
|
PROP(int, tick_pixel_space)
|
|
PROP(QString, time_format)
|
|
PROP(QFont, font)
|
|
/// 推入一个新的时间点并返回对应 tick。
|
|
int give_data(QTime time);
|
|
/// 将 tick 转换成时间。
|
|
QTime tick_to_time(int tick, SRC = SRC::Edit);
|
|
struct Builder;
|
|
};
|
|
struct Time_Axis_Prop {
|
|
int time_point_size = 100;
|
|
int tick_pixel_space = 8;
|
|
QString time_format = "mm:ss.zzz";
|
|
QFont font;
|
|
};
|
|
struct LIB_DECL Time_Axis::Builder : Abs_Axis::BuilderT<Time_Axis::Builder>,
|
|
protected Time_Axis_Prop {
|
|
PROP_B(int, time_point_size)
|
|
PROP_B(int, tick_pixel_space)
|
|
PROP_B(QString, time_format)
|
|
PROP_B(QFont, font)
|
|
/// 创建时间轴构造器。
|
|
Builder(Plot* plot, Qt::Orientation orientation);
|
|
/// 构建并返回时间轴对象。
|
|
Time_Axis* build();
|
|
};
|
|
} // namespace YSG
|