コード例 #1
0
	bool CGeorgesFormProxyModel::filterAcceptsRow(int sourceRow,
		const QModelIndex &sourceParent) const
	{
		// column doesnt matter for item
		CGeorgesFormModel *smodel = dynamic_cast<CGeorgesFormModel *>(sourceModel());
		QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
		CFormItem *item   = smodel->getItem(index);

		// if elm not existing it must be some kind of default or type value
		if(!item->getFormElm())
		{
			return smodel->showDefaults();
		}

		// else it might be some parent elm
		switch (item->nodeFrom())
		{
		case NLGEORGES::UFormElm::NodeParentForm:
			{
				return smodel->showParents();
			}
		case NLGEORGES::UFormElm::NodeForm:
			{
				switch (item->valueFrom())
				{
				case NLGEORGES::UFormElm::ValueParentForm:
					{
						return smodel->showParents();
					}
				default:
					{
						CFormItem *parent = item->parent();
						if (parent && (parent->nodeFrom() == NLGEORGES::UFormElm::NodeParentForm))
						{
							return smodel->showParents();
						}
					}
				}
			}
		}
		return true;
	}