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

56 lines
1.3 KiB
C

#ifndef CUICOMPONENTBASE_H
#define CUICOMPONENTBASE_H
#include <QWidget>
#include <QVariant>
#include "CUIPropertyAPI.h"
#include "CUIConfig.h"
#include "CUIDefine.h"
class CUIPropertyAPI CUIComponentBase : public QWidget
{
Q_OBJECT
public:
explicit CUIComponentBase(QWidget *parent = nullptr);
protected:
// 初始化配置
void initSetting();
// 判断是否在范围内
bool inRange();
// 初始化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 = false;
// 左值
QVariant m_rangeMin;
// 右值
QVariant m_rangeMax;
// 是否包含左值
bool m_inclusiveMin = false;
// 是否包含右值
bool m_inclusiveMax = false;
// 是否是必填
bool m_required = true;
signals:
};
#endif // CUICOMPONENTBASE_H