#ifndef VIEWMODELS_H #define VIEWMODELS_H #include #include #include #include #include "SysPara.h" #include #include enum InkType { INK_TYPE_BLACK, INK_TYPE_WHITE, }; /** * @brief 计数器类型 * */ enum COUNTER_TYPE { COUNTER_TYPE_1 = 7, COUNTER_TYPE_2 = 8, }; /** * @brief 计数器设置界面所用的视图模型 * */ struct CounterViewModel { int counterType = COUNTER_TYPE_1; // 实际类型为 COUNTER_TYPE int digitalNum = 2; int letterSpace = 2; int charWidth = 0; // 字符宽度,仅在 enbCustomCharWidth == true 时有意义 bool enbCustomCharWidth = false; static void loadFromXml(CounterViewModel& vm, const QXmlStreamAttributes& attrs); static void saveToXml(CounterViewModel& vm, QXmlStreamAttributes& attrs); }; Q_DECLARE_METATYPE(CounterViewModel); /** * @brief 日期设置界面所用的视图模型 * */ struct DateItemModel { QString datetimePattern; int monthsOffset = 0; int daysOffset = 0; QStringList dataMap; // unused QStringList daysMap; QStringList monthsMap; QMap yearsMap; QStringList weeksMap; QStringList hoursMap; static DateItemModel createDefaultReplaceModel(); static void loadFromXml(DateItemModel& vm, const QXmlStreamAttributes& attrs); static void saveToXml(const DateItemModel& vm, QXmlStreamAttributes& attrs); }; Q_DECLARE_METATYPE(DateItemModel); #endif // VIEWMODELS_H