|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "iDlgBase.h"
|
|
|
|
|
#include "iResultInfo.h"
|
|
|
|
|
#include "iGuiGridPty_global.h"
|
|
|
|
|
|
|
|
|
|
class iUnitGroup;
|
|
|
|
|
|
|
|
|
|
// 参数区每一项Item的基类
|
|
|
|
|
class X_GUI_GRIDPTY_EXPORT iGridRowItem : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
explicit iGridRowItem(iGridRowItem* pParent = NULL);
|
|
|
|
|
~iGridRowItem();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// 序列化
|
|
|
|
|
virtual void onSerialize(ZxSerializer* ser);
|
|
|
|
|
virtual void onDeserialize(ZxSerializer* ser);
|
|
|
|
|
|
|
|
|
|
// 父子关系处理
|
|
|
|
|
virtual void setDlgBase(QWidget* p);//父窗体、位置控制
|
|
|
|
|
iGridRowItem* getParent(); //父
|
|
|
|
|
bool isParentCollapsed(); //父级节点是否折叠
|
|
|
|
|
int appendChild(iGridRowItem* p); //添加孩子
|
|
|
|
|
int getChildCount(); //孩子数目
|
|
|
|
|
int getChildVisibleCount(); //可见的孩子数目
|
|
|
|
|
iGridRowItem* getChildAt(int n); //获取
|
|
|
|
|
void removeAllChilds(); //Clear
|
|
|
|
|
bool getAllItems(QVector<iGridRowItem*>& vec);//不考虑层级
|
|
|
|
|
int getItemLevel(); //获取层次级别
|
|
|
|
|
iGridRowItem* getActiveItem(); //当前节点及孩子中的Active节点
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// 管理子控件
|
|
|
|
|
virtual void initEditor();
|
|
|
|
|
virtual void initOtherEditors();
|
|
|
|
|
virtual void hideEditors();
|
|
|
|
|
virtual void configEditor();
|
|
|
|
|
virtual QString getEditorCss(bool bValid);
|
|
|
|
|
virtual QWidget* getMainEditor();
|
|
|
|
|
|
|
|
|
|
// 位置相关Bounds
|
|
|
|
|
virtual void setBounds(QRectF& rt); //全局
|
|
|
|
|
virtual QRectF getBounds(); //
|
|
|
|
|
virtual QRectF getLeftBounds(); //左
|
|
|
|
|
virtual QRectF getRightBounds_Main();//右
|
|
|
|
|
virtual QRectF getIconBound(); //Icon的Bound
|
|
|
|
|
virtual void setSplitPos(float f); //中间分隔
|
|
|
|
|
virtual float getItemHeight(); //当前节点高度,包括孩子
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// 绘图
|
|
|
|
|
virtual void paint(QPainter* pPainter);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void paintGroup(QPainter* pPainter, int nCountVisible);
|
|
|
|
|
virtual void paintItem(QPainter* pPainter);
|
|
|
|
|
virtual void _paintItemTag(QPainter* pPainter, QString s);
|
|
|
|
|
virtual void _paintItemValue(QPainter* pPainter);
|
|
|
|
|
virtual void _paintItemIcon(QPainter* pPainter);
|
|
|
|
|
virtual void _paintItemGrid(QPainter* pPainter);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// 属性set/get
|
|
|
|
|
bool isShowAsResult();
|
|
|
|
|
virtual void setShowAsResult(bool b);
|
|
|
|
|
bool isExpanded();
|
|
|
|
|
virtual void setExpanded(bool b);
|
|
|
|
|
bool isVisible();
|
|
|
|
|
virtual void setVisible(bool b);
|
|
|
|
|
bool isActive();
|
|
|
|
|
virtual void setActive(bool b);
|
|
|
|
|
bool isReadonly();
|
|
|
|
|
virtual void setReadonly(bool b);
|
|
|
|
|
virtual void onItemDoubleCliked(GridTickPos o);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// HitTest
|
|
|
|
|
virtual bool hitTest(QPoint pt, GridTickPos& ht, \
|
|
|
|
|
iGridRowItem*& pItem);
|
|
|
|
|
virtual bool hitTest_SelfOnly(QPoint pt, GridTickPos& ht, \
|
|
|
|
|
iGridRowItem*& pItem);
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
|
|
void sigUnableSP(bool&);
|
|
|
|
|
void sigValueChanged(QString sPara, QVariant o);
|
|
|
|
|
/// @brief 触发参数改变,允许外界进行更改
|
|
|
|
|
/// @param o1: 主要数据,m_oRawValue
|
|
|
|
|
/// @param o2: 辅助数据,如Cbx的下拉填充内容QStringList
|
|
|
|
|
void sigValuePrevChanged(QVariant& o1, QVariant& o2);
|
|
|
|
|
void sigActiveItem(iGridRowItem*);
|
|
|
|
|
// 获取其它参数当前的数值
|
|
|
|
|
void sigGetValueOf(QString sPara, QVariant& o, bool& bOk);
|
|
|
|
|
|
|
|
|
|
// 是否启用正则验证,比如,直角边界,第一个边界要大于井长/2,只有点源才支持
|
|
|
|
|
void sigOuterValidate(QString sPara, QVariant o, bool& bValid, bool& bSet);
|
|
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
|
|
|
|
|
|
// QLineEdit 类型的数据change响应
|
|
|
|
|
virtual void slotItemValueChanged(QString s);
|
|
|
|
|
virtual void slotItemNeedActivate(bool);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// 设置各个参数
|
|
|
|
|
|
|
|
|
|
iParameter* getParameter(); //参数体
|
|
|
|
|
virtual void setParameter(iParameter* p);
|
|
|
|
|
|
|
|
|
|
QString getTag(); //左侧标识
|
|
|
|
|
virtual void setTagInner(QString sTag);
|
|
|
|
|
QString getTagInner();
|
|
|
|
|
virtual void setTagOuter(QString sTag); //允许外界直接传递,进行更改
|
|
|
|
|
QString getTagOuter();
|
|
|
|
|
QString getTagEx(); //左侧标识,增加一级处理
|
|
|
|
|
QString getTips();
|
|
|
|
|
|
|
|
|
|
QString getName(); //Name
|
|
|
|
|
QString getNameInner();
|
|
|
|
|
virtual void setNameInner(QString s);
|
|
|
|
|
|
|
|
|
|
// 该基类默认按float进行实现
|
|
|
|
|
virtual bool setCurValue(QVariant o);//现值
|
|
|
|
|
virtual QVariant getCurValue();
|
|
|
|
|
virtual QString getShowValue(); //非激活时显示在右侧的文本
|
|
|
|
|
|
|
|
|
|
// 原值,请在setParameter之前调用
|
|
|
|
|
virtual void setRawValue(QVariant o);
|
|
|
|
|
QVariant getRawValue();
|
|
|
|
|
|
|
|
|
|
// 数据范围
|
|
|
|
|
virtual QString getParaScales();
|
|
|
|
|
|
|
|
|
|
// 对于Editor的范围及颜色管理
|
|
|
|
|
virtual void checkAndClr();
|
|
|
|
|
// 获取范围
|
|
|
|
|
virtual bool getMaxMin(float& fMax, float& fMin);
|
|
|
|
|
|
|
|
|
|
// 最后的结果输出
|
|
|
|
|
virtual QString getInfoLeft();
|
|
|
|
|
virtual QVariant getInfoRight();
|
|
|
|
|
virtual QString getInfoUnit();
|
|
|
|
|
virtual bool isInputOk();
|
|
|
|
|
virtual bool isValidateOk(float f);//正则验证是否正确
|
|
|
|
|
|
|
|
|
|
// 20240704 新增接口
|
|
|
|
|
// 主要是设计类似流动段这类复合Item的序列化相关
|
|
|
|
|
virtual bool checkAndSetParaValue(QString sPara, QVariant o);
|
|
|
|
|
virtual bool checkAndGetParaValue(QString sPara, QVariant& o);
|
|
|
|
|
// 返回所有参数,Key为英文ID
|
|
|
|
|
virtual bool checkAndGetSubParaValues(QMap<QString, QVariant>& map,
|
|
|
|
|
bool bOnlyFitted = false,
|
|
|
|
|
bool bClearMap = true);
|
|
|
|
|
virtual bool checkAndGetSubParaUnits(QMap<QString, QString>& map,
|
|
|
|
|
bool bOnlyFitted = false,
|
|
|
|
|
bool bClearMap = true);
|
|
|
|
|
virtual bool checkAndOrgaSubResults(QVector<iResultInfo>& vec, QString sType);
|
|
|
|
|
|
|
|
|
|
virtual void organizeResult(iResultInfo& o, QString sType);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
// 对于只读等属性的管理
|
|
|
|
|
virtual void openItemPty(); //赋值前打开
|
|
|
|
|
virtual void restoreItemPty();//赋值后恢复
|
|
|
|
|
|
|
|
|
|
virtual bool isUnableSP();
|
|
|
|
|
virtual void activateItemChanged(QVariant o);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
// 对应的参数
|
|
|
|
|
iParameter* m_pParameter;
|
|
|
|
|
QString m_sNameInner; //这是内部的Name,包括流动段相关的1,2,3
|
|
|
|
|
QString m_sTagInner;
|
|
|
|
|
QString m_sTagOuter;
|
|
|
|
|
|
|
|
|
|
QVariant m_oRawValue; //原始值
|
|
|
|
|
QString m_sRawUnit; //原始单位
|
|
|
|
|
int m_nDigit; //小数位数
|
|
|
|
|
|
|
|
|
|
iUnitGroup* m_pUnitGroup;//载体
|
|
|
|
|
|
|
|
|
|
// 父子关系
|
|
|
|
|
QWidget* m_pDlgBase; //承载的Wx
|
|
|
|
|
iGridRowItem* m_pParent; //父级节点
|
|
|
|
|
QVector<iGridRowItem*> m_vecChildren; //孩子节点
|
|
|
|
|
|
|
|
|
|
// 内嵌组件
|
|
|
|
|
QWidget* m_pEditor;
|
|
|
|
|
QVector<QWidget*> m_vecEditors;
|
|
|
|
|
|
|
|
|
|
// 状态
|
|
|
|
|
bool m_bVisible;
|
|
|
|
|
bool m_bActive;
|
|
|
|
|
bool m_bExpanded;
|
|
|
|
|
|
|
|
|
|
// 20181228与参数载体的readonly不是一回事
|
|
|
|
|
// 允许外界动态修改
|
|
|
|
|
bool m_bReadonly;
|
|
|
|
|
|
|
|
|
|
// 位置信息
|
|
|
|
|
QRectF m_rtBounds;
|
|
|
|
|
float m_fSplitPos;
|
|
|
|
|
|
|
|
|
|
// Group模式的背景色
|
|
|
|
|
QColor m_groupBackColor[3];
|
|
|
|
|
|
|
|
|
|
// 图标
|
|
|
|
|
QPixmap m_oPixCollapse;
|
|
|
|
|
QPixmap m_oPixExpand;
|
|
|
|
|
|
|
|
|
|
// 导出时是否显示,对于组默认不显示,但流动段特殊
|
|
|
|
|
bool m_bShowAsResult;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// 其它常量
|
|
|
|
|
float m_fIconWidth;
|
|
|
|
|
float m_fIconMarginH;
|
|
|
|
|
float m_fIconMarginV;
|
|
|
|
|
float m_fRowHeight;
|
|
|
|
|
float m_fSplitPading;
|
|
|
|
|
};
|