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.
nmWATI/Include/iGui/iGuiGridPty/iGridLineItem.h

146 lines
3.7 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#include "iDlgBase.h"
#include "iResultInfo.h"
#include "iGuiGridPty_global.h"
class iModelInfoBase;
// 列表区每一项Item的基类应用于模型选择
class X_GUI_GRIDPTY_EXPORT iGridLineItem : public QObject
{
Q_OBJECT
public:
explicit iGridLineItem(iGridLineItem* pParent = NULL);
~iGridLineItem();
public:
// 序列化
virtual void onSerialize(ZxSerializer* ser);
virtual void onDeserialize(ZxSerializer* ser);
// 父子关系处理
virtual void setDlgBase(QWidget* p);//父窗体、位置控制
iGridLineItem* getParent(); //父
bool isParentCollapsed(); //父级节点是否折叠
int appendChild(iGridLineItem* p); //添加孩子
int getChildCount(); //孩子数目
iGridLineItem* getChildAt(int n); //获取
void removeAllChilds(); //Clear
bool getAllItems(QVector<iGridLineItem*>& vec);//不考虑层级
int getItemLevel(); //获取层次级别
virtual iGridLineItem* getActiveItem(); //当前节点及孩子中的Active节点
public:
// 位置相关Bounds
virtual void setBounds(QRectF& rt); //全局
virtual QRectF getBounds(); //
virtual QRectF getLeftBounds(); //左
virtual float getItemHeight(); //当前节点高度
public:
// 绘图
virtual void paint(QPainter* pPainter);
protected:
virtual bool isPaintNeeded();
virtual void paintItem(QPainter* pPainter);
virtual void _paintItemTag(QPainter* pPainter, QString s);
public:
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, \
iGridLineItem*& pItem);
virtual bool hitTest_SelfOnly(QPoint pt, GridTickPos& ht, \
iGridLineItem*& pItem);
signals:
void sigUnableSP(bool&);
void sigValueChanged(QString sPara, QVariant o);
void sigActiveItem(iGridLineItem*);
// 获取其它参数当前的数值
void sigGetValueOf(QString sPara, QVariant& o, bool& bOk);
protected slots:
// QLineEdit 类型的数据change响应
virtual void slotItemNeedActivate(bool);
public:
// 设置各个参数
iModelInfoBase* getDataObj(); //参数体
virtual void setDataObj(iModelInfoBase* p);
QString getTag(); //左侧标识
virtual void setTagInner(QString sTag);
QString getTagInner();
virtual void setTagOuter(QString sTag); //允许外界直接传递,进行更改
QString getTagOuter();
QString getTips();
QString getName(); //Name
QString getNameInner();
virtual void setNameInner(QString s);
// 最后的结果输出
virtual QString getInfoLeft();
protected:
virtual bool isUnableSP();
protected:
// 对应的参数
iModelInfoBase* m_pDataObj;
QString m_sNameInner; //这是内部的Name包括流动段相关的1,2,3
QString m_sTagInner;
QString m_sTagOuter;
// 父子关系
QWidget* m_pDlgBase; //承载的Wx
iGridLineItem* m_pParent; //父级节点
QVector<iGridLineItem*> m_vecChildren; //孩子节点
// 状态
bool m_bVisible;
bool m_bActive;
bool m_bExpanded;
// 20181228与参数载体的readonly不是一回事
// 允许外界动态修改
bool m_bReadonly;
// 位置信息
QRectF m_rtBounds;
float m_fSplitPos;
public:
// 其它常量
float m_fRowHeight;
float m_fSplitPading;
};