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.
nmWTAI-Platform/Include/iGui/iGuiBase/iDlgBase.h

103 lines
3.1 KiB
C

#pragma once
#include "ZxUiBase.h"
#include "Defines.h"
#include "ZxBaseUtil.h"
#include "iGuiBase_global.h"
class iParameter;
class iParaItemCtrl;
class ZxSerializer;
class iUnitWxBinder;
/// @brief 基础窗体ZxUiBase之上的再次封装
class X_GUI_BASE_EXPORT iDlgBase : public ZxUiBase
{
Q_OBJECT
public:
explicit iDlgBase(QWidget *parent = 0);
~iDlgBase();
public:
// 序列化
virtual void onSerialize(ZxSerializer* ser);
virtual void onDeserialize(ZxSerializer* ser);
// 权宜之计
// 在pCtrl InitUI之前允许部分调整如参数跟着模型走的调整
virtual void adjustParaInfos(iParameter* pParameter);
// 响应ParaCtrl数据的改变
virtual void slotParaCtrlValueChanged(QString sPara, QVariant o);
// 从当前井获取该参数的数值
virtual bool getValueFromCurWell(QString sPara, QVariant& o);
// 当清空Layout布局时把m_mapCtrls中涉及到的Wx清除
virtual bool removeSubCtrlCached(QWidget* pWx);
// 参数来源标识,默认情况下,为 s_Sys_Para_Default
void setParaSrcTag(QString s);
// 绑定单位对
// 需要特别注意调用该函数之前如果需要更改参数来源标识一定要先setParaSrcTag
virtual bool bindUnitPairWxs(QLineEdit* pTbx, \
QComboBox* pCbx, \
QString sPara, \
bool bBindOnly);
// 绑定单位对
// 需要特别注意调用该函数之前如果需要更改参数来源标识一定要先setParaSrcTag
virtual bool bindUnitPairWxs(QLineEdit* pTbx1, \
QLineEdit* pTbx2, \
QComboBox* pCbx, \
QString sPara, \
bool bBindOnly);
// 基准数值及单位
virtual bool getUnitBinderParaValue(QString sPara, double& d);
virtual bool getUnitBinderParaUnit(QString sPara, QString& sUnit);
// virtual bool getAllUnitBinderParaValues(QMap<QString, double>& map,
// bool bClearMap = true);
// virtual bool getAllUnitBinderParaUnits(QMap<QString, QString>& map,
// bool bClearMap = true);
protected slots:
/// @brief 对于参数/单位绑定的情形,数据编辑,允许外部进行判断是否合理
/// @param sPara 具体哪个参数,英文标识
/// @param baseValue 基准数值,并非显示数值
/// @param bValid 是否有效的数值,返回值
virtual void slotValidateParaInput(const QString sPara, const double baseValue, bool& bValid);
protected:
// 单位切换
double convertValueByUnit(double d,
QString sUnitSrc,
QString sUnitDest);
protected:
// 窗体关闭的情形
virtual void closeEvent(QCloseEvent *);
// 重写消息
virtual bool event(QEvent *event);
protected:
iUnitWxBinder* m_pUnitBinder;
// 参数来源标识,默认情况下,为 s_Sys_Para_Default
// 不涉及序列化
QString m_sParaSrcTag;
};