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.
AppFlow/CFDStruct/CUIProperty/CUIComponentBase.h

57 lines
1.4 KiB
C

#ifndef CUICOMPONENTBASE_H
#define CUICOMPONENTBASE_H
#include <QObject>
#include <QVariant>
#include "CUIPropertyAPI.h"
#include "CUIConfig.h"
#include "CUIDefine.h"
class CUIPropertyAPI CUIComponentBase
{
public:
explicit CUIComponentBase();
protected:
// 初始化配置
void initSetting();
// 判断是否在范围内
bool inRange(QVariant v);
// 将当前的值修改为QVarivat变量
QVariant getQVFrom(QString str);
// 初始化UI
virtual void initUI();
// 初始化值校验器
virtual void initValidator();
// 获取值的字符串形式
QString getValueString();
// 获取最小值的字符串形式
QString getRangeMinString();
// 获取最大值的字符串形式
QString getRangeMaxString();
// 同步到数据来源
void setValueToOrigin();
protected:
CUIConfig* m_conf = nullptr;
// 值类型
CUI_DATA_TYPE m_dataType = CUI_DATA_TYPE::CUI_DATA_TYPE_UNKNOW;
// 具体值
QVariant m_value = QVariant::Invalid;
// 是否检查范围
bool m_checkRange = true;
// 左值
QVariant m_rangeMin = INT_MIN;
// 右值
QVariant m_rangeMax = INT_MAX;
// 是否包含左值
bool m_inclusiveMin = false;
// 是否包含右值
bool m_inclusiveMax = false;
// 是否是必填
bool m_required = true;
signals:
};
#endif // CUICOMPONENTBASE_H