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

159 lines
4.1 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();
enum LineItemState
{
LIS_Activate = 0, //激活,鼠标选中,即为激活
LIS_Selected, //选用,即进行了处理解释
LIS_Visible, //是否可见
LIS_Expanded, //是否扩展只对Group有效
LIS_Unknown
};
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(); //获取层次级别
public:
// 位置相关Bounds
virtual void setBounds(QRectF& rt); //全局
virtual QRectF getBounds(); //
virtual QRectF getLeftBounds(); //左
virtual double getItemHeight(); //当前节点高度
public:
// 绘图
virtual void paint(QPainter* pPainter);
protected:
virtual bool isPaintNeeded();
virtual void paintItem(QPainter* pPainter);
virtual void _paintItemTag(QPainter* pPainter, QString s);
public:
// 当前节点及孩子中的特定状态的节点(唯一)
virtual iGridLineItem* getItemOfState(LineItemState o);
virtual bool isStateOf(LineItemState o);
void setStateOf(LineItemState o, bool bReverse = false);
// 是否激活,鼠标选中,即为激活
bool isActive();
virtual void setActive(bool b);
// 是否选用,即进行了处理解释
bool isSelected();
virtual void setSelected(bool b);
// 是否可见
bool isVisible();
virtual void setVisible(bool b);
// 是否扩展只对Group有效
bool isExpanded();
virtual void setExpanded(bool b);
// 20181228与参数载体的readonly不是一回事
// 允许外界动态修改
bool isReadonly();
virtual void setReadonly(bool b);
// 其实就是是否分组标识(但是有些不是),需要注意
bool isSeparator();
public:
// HitTest
virtual bool hitTest(QPoint pt, GridTickPos& ht, \
iGridLineItem*& pItem);
virtual bool hitTest_SelfOnly(QPoint pt, GridTickPos& ht, \
iGridLineItem*& pItem);
// virtual void onItemDoubleCliked(GridTickPos o);
signals:
void sigUnableSP(bool&);
void sigValueChanged(QString sPara, QVariant o);
//void sigActiveItem(iGridLineItem*);
protected slots:
// QLineEdit 类型的数据change响应
//virtual void slotItemNeedActivate(bool);
public:
// 设置各个参数
iModelInfoBase* getDataObj(); //数据载体体
virtual void setDataObj(iModelInfoBase* p);
QString getTag(bool bSimple = false);//左侧标识
protected:
virtual bool isUnableSP();
protected:
// 对应的参数
iModelInfoBase* m_pDataObj;
// 父子关系
QWidget* m_pDlgBase; //承载的Wx
iGridLineItem* m_pParent; //父级节点
QVector<iGridLineItem*> m_vecChildren; //孩子节点
// 状态
bool m_bActive; //是否激活,鼠标选中,即为激活
bool m_bSelected; //是否选用,即进行了处理解释
bool m_bVisible; //是否可见
bool m_bExpanded; //是否扩展只对Group有效
// 20181228与参数载体的readonly不是一回事
// 允许外界动态修改
bool m_bReadonly;
// 位置信息
QRectF m_rtBounds;
double m_fSplitPos;
public:
// 其它常量
double m_fRowHeight;
double m_fSplitPading;
};