|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "iDlgBase.h"
|
|
|
|
|
#include "iResultInfo.h"
|
|
|
|
|
#include "iGridLineItem.h"
|
|
|
|
|
|
|
|
|
|
class iModelInfoBase;
|
|
|
|
|
//class iGridLineItem;
|
|
|
|
|
|
|
|
|
|
// 列表区统一处理的Utils(应用于模型选择)
|
|
|
|
|
class X_GUI_GRIDPTY_EXPORT iGridLineUtils : public iDlgBase
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
explicit iGridLineUtils(QWidget *parent = 0);
|
|
|
|
|
~iGridLineUtils();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// 初始化
|
|
|
|
|
virtual void initUI();
|
|
|
|
|
|
|
|
|
|
// 对外暴露接口
|
|
|
|
|
void setLineItems(QVector<iGridLineItem*>& vec, \
|
|
|
|
|
QWidget* pWxDlg);
|
|
|
|
|
bool buildLineUtils(QVector<iModelInfoBase*> vecDataObjs, \
|
|
|
|
|
QWidget* pWxDlg);
|
|
|
|
|
iGridLineItem* buildLineItemOf(iModelInfoBase* pDataObj, \
|
|
|
|
|
iGridLineItem* pParent, \
|
|
|
|
|
QString sLastItem);
|
|
|
|
|
void setModelType(QString s);
|
|
|
|
|
|
|
|
|
|
// 边界相关
|
|
|
|
|
void setBounds(QRectF& rt);
|
|
|
|
|
float getUtilHeight();
|
|
|
|
|
|
|
|
|
|
void connectSignalsOf(iGridLineItem* p);
|
|
|
|
|
|
|
|
|
|
void bkAllItems();
|
|
|
|
|
QStringList getAllTags(); //不考虑层级
|
|
|
|
|
|
|
|
|
|
void resetLayout(); //重置
|
|
|
|
|
|
|
|
|
|
// 清空
|
|
|
|
|
void clearAllItems();
|
|
|
|
|
|
|
|
|
|
// 刷新
|
|
|
|
|
void updateItem(iGridLineItem* p);
|
|
|
|
|
|
|
|
|
|
/// @brief 改变某个item的状态
|
|
|
|
|
/// @note bExclusive表示是否排他性,比如只有一种激活
|
|
|
|
|
void changeItemState(iGridLineItem* p, \
|
|
|
|
|
iGridLineItem::LineItemState o, \
|
|
|
|
|
bool bExclusive = true);
|
|
|
|
|
|
|
|
|
|
// 模型解释选用了某一项
|
|
|
|
|
void setItemAsSelected(QString sAlias, bool bSelected = true);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
// 搭建过程
|
|
|
|
|
QStringList getParaTypes(QStringList listParas);
|
|
|
|
|
iGridLineItem* createAndAddItem(iGridLineItem* pParent, \
|
|
|
|
|
iModelInfoBase* pDataObj, \
|
|
|
|
|
bool bGroup);
|
|
|
|
|
void insertItem(int nIndex, iGridLineItem* pItem);
|
|
|
|
|
|
|
|
|
|
// 把所有Item从上到下(不考虑层级记录下来)
|
|
|
|
|
bool getAllItems(QVector<iGridLineItem*>& vec); //不考虑层级
|
|
|
|
|
|
|
|
|
|
// 范围及布局
|
|
|
|
|
void updateLayout();
|
|
|
|
|
void doLayout();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
virtual void mousePressEvent(QMouseEvent *);
|
|
|
|
|
virtual void mouseDoubleClickEvent(QMouseEvent * e);
|
|
|
|
|
virtual void mouseReleaseEvent(QMouseEvent *);
|
|
|
|
|
virtual void mouseMoveEvent(QMouseEvent *);
|
|
|
|
|
|
|
|
|
|
virtual void resizeEvent(QResizeEvent *);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
virtual void paintEvent(QPaintEvent*);
|
|
|
|
|
void paintGrid(QPainter* pPainter);
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
|
|
void sigHelpMsg(QString& s);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
// 节点操作及属性更改
|
|
|
|
|
GridTickPos hitTest(QPoint pt);
|
|
|
|
|
|
|
|
|
|
void expand(iGridLineItem* p);
|
|
|
|
|
void collapse(iGridLineItem* p);
|
|
|
|
|
|
|
|
|
|
// 获取上一个item
|
|
|
|
|
iGridLineItem* getLastItemOfState(iGridLineItem::LineItemState o);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// 组织数据
|
|
|
|
|
// 序列化
|
|
|
|
|
virtual void onSerialize(ZxSerializer* ser);
|
|
|
|
|
virtual void onDeserialize(ZxSerializer* ser);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
// 窗体载体
|
|
|
|
|
QWidget* m_pWxDlg;
|
|
|
|
|
|
|
|
|
|
// 属于哪一类
|
|
|
|
|
QString m_sModelType;
|
|
|
|
|
|
|
|
|
|
// 子项
|
|
|
|
|
QVector<iGridLineItem*> m_vecLineItems;
|
|
|
|
|
QVector<iGridLineItem*> m_vecAllItems;// 从上到下不考虑层级,所有
|
|
|
|
|
iGridLineItem* m_pItemSel;
|
|
|
|
|
|
|
|
|
|
// 位置及布局
|
|
|
|
|
QRectF m_rtBounds;
|
|
|
|
|
bool m_bNeedLayout;
|
|
|
|
|
|
|
|
|
|
// Header
|
|
|
|
|
bool m_bHeaderVisible;
|
|
|
|
|
|
|
|
|
|
float m_fRowHeight;
|
|
|
|
|
};
|