void CWidgetSearchTemplate::on_treeViewSearchResults_doubleClicked(const QModelIndex &index)
{
	Q_UNUSED(index);
	SearchTreeItem* itemSearch = m_pSearchModel->topLevelItemFromIndex(CurrentItem());

	if( itemSearch != NULL )
	{
		CQueryHit* pHits = 0;
		CQueryHit* pLast = 0;

		for(int i = 0; i < itemSearch->childCount(); ++i)
		{
			if( pLast )
			{
				pLast->m_pNext = new CQueryHit(itemSearch->child(i)->HitData.pQueryHit.data());
				pLast = pLast->m_pNext;
			}
			else
			{
				pHits = new CQueryHit(itemSearch->child(i)->HitData.pQueryHit.data());
				pLast = pHits;
			}
		}

		Downloads.m_pSection.lock();
		Downloads.add(pHits);
		Downloads.m_pSection.unlock();

		delete pHits;
	}
}
示例#2
0
int SearchTreeModel::rowCount( const QModelIndex& parent ) const
{
	SearchTreeItem* parentItem;
	if ( parent.column() > 0 )
	{
		return 0;
	}

	if ( !parent.isValid() )
	{
		parentItem = m_pRootItem;
	}
	else
	{
		parentItem = static_cast<SearchTreeItem*>( parent.internalPointer() );
	}

	return parentItem->childCount();
}