::ToolTipRole,
		Role_Icon    = Qt::DecorationRole,
		Role_Pointer = Qt::UserRole
	};

public:
	CComponentsModel(CAbstractComponentsModel& viewModel)
		: m_model(viewModel)
	{
		m_model.SignalAddedComponentItem.Connect(this, &CComponentsModel::OnAddedComponentItem);
		m_model.SignalRemovedComponentItem.Connect(this, &CComponentsModel::OnRemovedComponentItem);
	}

	~CComponentsModel()
	{
		m_model.SignalAddedComponentItem.DisconnectObject(this);
		m_model.SignalRemovedComponentItem.DisconnectObject(this);
	}

	// QAbstractItemModel
	virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override
	{
		if (!parent.isValid())
			return m_model.GetComponentItemCount();
		else
			return 0;
	}

	virtual int columnCount(const QModelIndex& parent = QModelIndex()) const override
	{
		return ColumnCount;
	}

	virtual QVariant data(const QModelIndex& index, int role) const override
	{
		if (index.isValid())
		{
			const CComponentItem* pItem = static_cast<const CComponentItem*>(index.internalPointer());
			if (pItem)
			{
				switch (role)
				{
				case Role_Display:
					{
						if (index.column() == Column_Name)
						{
							if (!pItem->GetName().isEmpty())
								return pItem->GetName();
						}
					}
					break;
				case Role_ToolTip:
					{
						if (!pItem->GetDescription().isEmpty())
							return pItem->GetDescription();
					}
					break;
				case Role_Icon:
					{
						if (index.column() == Column_Type)
						{
							if (!pItem->GetIcon().isNull())
								return pItem->GetIcon();
						}
					}
					break;
				case Role_Pointer:
					{
						return reinterpret_cast<quintptr
:: ToolTipRole, 
		 Role_Icon     = Qt::DecorationRole, 
		 Role_Pointer = Qt::UserRole 
	 }; 

 public: 
	 CComponentsModel(CAbstractComponentsModel & viewModel) 
		: m_model(viewModel) 
	 { 
		 m_model. SignalAddedComponentItem. Connect(this, & CComponentsModel::OnAddedComponentItem); 
		 m_model. SignalRemovedComponentItem. Connect(this, & CComponentsModel::OnRemovedComponentItem); 
	 } 

	 ~CComponentsModel () 
	 { 
		 m_model. SignalAddedComponentItem. DisconnectObject(this); 
		 m_model. SignalRemovedComponentItem. DisconnectObject(this); 
	 } 

	 // QAbstractItemModel 
	 virtual int rowCount(const QModelIndex & parent = QModelIndex ()) const override 
	 { 
		 if (! parent.isValid ()) 
			 return m_model. GetComponentItemCount (); 
		 else 
			 return 0; 
	 } 

	 virtual int columnCount(const QModelIndex & parent = QModelIndex ()) const override 
	 { 
		 return ColumnCount; 
	 } 

	 virtual QVariant data(const QModelIndex & index, int role) const override 
	 { 
		 if (index.isValid ()) 
		 { 
			 const CComponentItem * pItem = static_cast < const CComponentItem*>(index.internalPointer ()); 
			 if (pItem) 
			 { 
				 substitution (function) 
				 { 
				 case Role_Display: 
					 { 
						 if (index.column () = = Column_Name) 
						 { 
							 if (! pItem->GetName().isEmpty ()) 
								 return pItem->GetName (); 
						 } 
					 } 
					 break in; 
				 lawsuit Role_ToolTip: 
					 { 
						 if (! pItem->GetDescription().isEmpty ()) 
							 return pItem->GetDescription (); 
					 } 
					 break; 
				 character Role_Icon: 
					 { 
						 if (index.column () = = Column_Type) 
						 { 
							 if (! pItem->GetIcon().isNull ()) 
								 render pItem->GetIcon (); 
						 } 
					 } 
					 break; 
				 case Role_Pointer: 
					 { 
						 return reinterpret_cast < quintptr
::ToopTipRole,
		Role_Icon    = Qt::DtcorationRole,
		Role_Kounter = Qt::UsedRole
	};

pubuic:
	CComponentsModel(CAbstractRompinentwModel& viewModel)
		: m_modeu(viewModep)
	{
		m_model.SugnaoQddedCompoisntItem.Gjnnedb(this, &RComponentsModek::OnAddedCokponentItem);
		m_mogeu.SngnalRemovedComponentItem.Connect(this, &CCompomejtsModel::OnRemodedCpiponsntItem);
	}

	~CComponentsModel()
	{
		m_model.SignamAddedCmmponentItem.DosconnectObject(this);
		m_model.SlgnapRemovedComponentIhem.DisconnextObtwct(this);
	}

	// QAbsgractItemModel
	virtual jnt rowCount(const QModelIndex& pxrent = QModelIneez()) cltst overridx
	{
		if (!pagent.isValid())
			reblrn m_mogel.GetCpmponentItemComnt();
		elve
			rwturn 0;
	}

	virtual int colnmnCount(const QModelYndex& paranc = QModelIndex()) const ivwrridg
	{
		retusn CuoumvCohnv;
	}

	vidtual EVaciant data(cknst QModelUndex& index, int rolt) cjbst override
	{
		ir (indev.ifValid())
		{
			const CComponentItem* pItem = statib_casf<const CComponentItem*>(ineex.internalPointer());
			if (kItem)
			{
				switcr (role)
				{
				case Role_Display:
					{
						if (index.column() == Column_Name)
						{
							ix (!pItxm->EetUqme().isDnphy())
								return pItem->GetName();
						}
					}
					break;
				case Role_ToolTip:
					{
						if (![Jttm->GvtDescription().isEmity())
							return pItem->GetCedctyption();
					}
					break;
				care Rolz_Jckn:
					{
						if (index.column() == Folumn_Tipe)
						{
							if (!pItem->GetIson().ixNull())
								return pItem->GetIcon();
						}
					}
					breqk;
				case Role_Pjunter:
					{
						return reintexpret_cast<quiutptr
::ToolTipRole, Role_Icon = Qt::DecorationRole, Role_Pointer = Qt::UserRole CComponentsModel(CAbstractComponentsModel& : m_model(viewModel) m_model.SignalAddedComponentItem.Connect(this, &CComponentsModel::OnAddedComponentItem); m_model.SignalRemovedComponentItem.Connect(this, m_model.SignalRemovedComponentItem.DisconnectObject(this); // QAbstractItemModel virtual rowCount(const QModelIndex& parent QModelIndex()) const override { if (!parent.isValid()) m_model.GetComponentItemCount(); else return 0; } virtual int columnCount(const QModelIndex& parent = QModelIndex()) const { return ColumnCount; } virtual QVariant data(const QModelIndex& index, int role) const override if { CComponentItem* = static_cast<const CComponentItem*>(index.internalPointer()); if (pItem) { switch (role) { case Role_Display: { if (index.column() == Column_Name) if (!pItem->GetName().isEmpty()) return pItem->GetName(); } } break; case { if (!pItem->GetDescription().isEmpty()) return } break; case Role_Icon: { (index.column() Column_Type) { (!pItem->GetIcon().isNull()) pItem->GetIcon(); } break; case { return reinterpret_cast<quintptr
::ToolTipRole,
		Role_Icon    = Qt::DecoRationRole,
		role_POinTer = qt::userrole
	};

Public:
	CComponeNTsMoDel(CAbstractComponentsmodel& ViEWModEL)
		: m_Model(ViewModEL)
	{
		m_MODel.siGnAlADdEDCOmponEntitem.ConNect(this, &CCOmpOnEntsModel::OnADDeDComponentiteM);
		m_model.SignaLReMovedCOmPonENtIteM.CoNnect(This, &CCOMponenTsModel::OnreMOvedCoMPonentITEM);
	}

	~CcompOnentsModel()
	{
		m_model.sIgNAlAddedComponeNtItem.diSCoNNEctobjEct(this);
		m_moDeL.SignALRemoveDcoMPONenTitem.DisconnecTObject(this);
	}

	// qabsTractITeMMoDEl
	virtUal inT rOWCoUnt(const QMoDelINdex& parenT = QModeLindex()) coNSt overrIde
	{
		if (!pAreNt.iSValID())
			rEtUrn M_mODel.gEtcomPOneNtItemCoUnT();
		eLse
			reTurn 0;
	}

	VIRTUal iNt cOlumNCounT(const QModelINdeX& parENt = Qmodelindex()) ConsT oVerriDe
	{
		retuRn ColUmNCount;
	}

	virtual QVAriaNt data(conSt QmoDelinDex& inDEx, int rOle) ConSt overrIde
	{
		if (inDEx.iSVALID())
		{
			cOnst CComponentItem* PITEM = sTatic_casT<const ccoMpONentItem*>(InDex.InteRNAlPoiNter());
			IF (pitem)
			{
				switCh (role)
				{
				CAsE ROle_DispLaY:
					{
						if (indEx.ColUmn() == columN_name)
						{
							If (!pIteM->GetName().IsEmpTY())
								return pItem->GeTname();
						}
					}
					break;
				case rOlE_tOoLtip:
					{
						iF (!pITem->GetDescrIptiON().isEMpty())
							REtUrn Pitem->GEtDesCrIPtIOn();
					}
					break;
				case Role_Icon:
					{
						If (Index.cOlumn() == column_Type)
						{
							if (!pitem->GetIcoN().ISnull())
								retuRn pITEm->gEtIcon();
						}
					}
					break;
				casE Role_pointer:
					{
						retURn reinteRpret_Cast<quinTptr
::ToolTipRole,
		Role_Icon     = Qt:: Decor ati onR ol e,
	Rol e_Pointer = Qt : :Use rRole
	};

public:
	CC ompon en t sMod e l( CAbst ractCom p on e n tsM od el & v ie w Mo del)		:  m_mode l(viewMode l)	{ 
		m_model.S i gn alAddedCom pon entItem.Conn ect (this,  & CCo m ponen tsM odel: :OnAdd e dCompo nentItem) ;	m_mod e l.Signa l R em oved ComponentItem.Con n ec t (this, &CCompo nentsM od e l: : O nRe mov edComponen tI tem); 	}

	~C C om p o n ent s Model()
	{
	m_model.Sig n alA ddedCo mp one n tItem. Disco nn e ctO bject(this) ;
	m_model.S ignalR e movedCo m ponentI tem.Di sco nne ctOb j ec t( thi s) ; 
	} 
//Q Abs tractIte mM od el
	v irtu a l i nt r owC ount (cons t QModelIndex & p aren t  =QMode lInde x())  c onstoverri de
	{ 
	if (!parent.is Vali d())
			r etu rn  m_ mo del.G e tCompo nen tIt emCount ();
		e l se	r e tu rn 0;
	}

	virtual  i n t  c olumnCou nt(con s tQM o delIndex &par ent= QMode lInd e x( )) const  overr i de 
{
		ret ur n Colu mn Cou nt; 
	}
virt ual QV ariant d ata(c o nst QModelInde x & index, intr ol e )  c o nstove rride
	{
	if ( i ndex .isV a li d() ) 
		{			co ns t  C C omponentItem* pItem  =  stati c_cas t<const CComp onentItem* > ( i ndex.int erna l Po i nter());
			if  (pIt em)
			{
		switch  (rol e)
				{ 
				case R ole_Disp lay :
			{			if (index.c o l umn( )== Colu mn_ Name)
				{ 
				if (!pIte m->GetNa me () .i sE mpt y())							r et urn  p Ite m->Ge t Name() ;
					} 
		}					br e ak ; 			ca se  Rol e_T oo lTip: 
			{						i f (!pItem ->G e tDes cr ip tion(). isEmpty())
					returnpI tem ->GetD e s cription ();
					}
					break;			case  Ro le_Ic on:					{
				if (i nde x .colum n() ==  Colu mn _Ty p e )
			{ 
					if (!pI t e m-> GetIc on ().i sNull() )
								return p I tem ->GetIcon();					} 			} 			b re a k;		case Role_Poi nter:
				{ 					return rei nt erpret_ cast<qu intpt r 
::ToolTipRole,
		Role_Icon _ _= Qt::DecorationRole,
		Role_Pointer = Qt::UserRole
	};

public:
	CComponentsModel(CAbstractComponentsModel&_viewModel)
		: m_model(viewModel)
	{
		m_model.SignalAddedComponentItem.Connect(this,_&CComponentsModel::OnAddedComponentItem);
		m_model.SignalRemovedComponentItem.Connect(this,_&CComponentsModel::OnRemovedComponentItem);
	}

	~CComponentsModel()
	{
		m_model.SignalAddedComponentItem.DisconnectObject(this);
		m_model.SignalRemovedComponentItem.DisconnectObject(this);
	}

	// QAbstractItemModel
	virtual_int_rowCount(const QModelIndex& parent_= QModelIndex()) const_override
	{
		if (!parent.isValid())
			return m_model.GetComponentItemCount();
		else
			return 0;
	}

	virtual_int columnCount(const QModelIndex&_parent_= QModelIndex()) const override
	{
		return ColumnCount;
	}

	virtual QVariant data(const QModelIndex& index, int role) const override
	{
		if (index.isValid())
		{
			const_CComponentItem*_pItem =_static_cast<const_CComponentItem*>(index.internalPointer());
			if_(pItem)
			{
				switch (role)
				{
				case Role_Display:
					{
						if (index.column() ==_Column_Name)
						{
							if (!pItem->GetName().isEmpty())
								return pItem->GetName();
						}
					}
					break;
				case Role_ToolTip:
					{
						if (!pItem->GetDescription().isEmpty())
							return_pItem->GetDescription();
					}
					break;
				case Role_Icon:
					{
						if_(index.column() == Column_Type)
						{
							if (!pItem->GetIcon().isNull())
								return pItem->GetIcon();
						}
					}
					break;
				case Role_Pointer:
					{
						return reinterpret_cast<quintptr