#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& map, // bool bClearMap = true); // virtual bool getAllUnitBinderParaUnits(QMap& 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; };