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/iGridLineUtils.h

133 lines
3.0 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"
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);
// 边界相关
void setBounds(QRectF& rt);
float getUtilHeight();
void connectSignalsOf(iGridLineItem* p);
void bkAllItems();
QStringList getAllTags(); //不考虑层级
void resetLayout(); //重置
// 根据名字获取
iGridLineItem* getItemByPara(QString sPara);
// 根据名字取数据
QVariant getItemValueByPara(QString sPara);
// 清空
void clearAllItems();
// 对Items进行检测正确输入
bool checkItems();
// 刷新
void updateItem(iGridLineItem* p);
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:
void slotActivateItem(iGridLineItem* p);
void onActiveItemChanged(iGridLineItem* p);
signals:
void sigHelpMsg(QString& s);
protected:
// 节点操作及属性更改
GridTickPos hitTest(QPoint pt);
void expand(iGridLineItem* p);
void collapse(iGridLineItem* p);
iGridLineItem* getLastActive();
public:
// 组织数据
// 序列化
virtual void onSerialize(ZxSerializer* ser);
virtual void onDeserialize(ZxSerializer* ser);
private:
// 窗体载体
QWidget* m_pWxDlg;
// 子项
QVector<iGridLineItem*> m_vecLineItems;
QVector<iGridLineItem*> m_vecAllItems;// 从上到下不考虑层级,所有
iGridLineItem* m_pItemSel;
// 位置及布局
QRectF m_rtBounds;
bool m_bNeedLayout;
// Header
bool m_bHeaderVisible;
float m_fRowHeight;
};