ResourcesTreeModel: encapsulate conversion from index to items

Encapsulate conversion from a QModelIndex to a ResourcesTreeItem
or a ResourcesItem into static methods.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
This commit is contained in:
Tobias Doerffel
2009-06-03 15:29:06 +02:00
parent 39b489d522
commit c5bf76b98c
2 changed files with 17 additions and 10 deletions

View File

@@ -62,6 +62,19 @@ public:
void setFilter( const QString & _s );
// return ResourcesTreeItem belonging to a certain index
static inline ResourcesTreeItem * treeItem( const QModelIndex & _idx )
{
return static_cast<ResourcesTreeItem *>(
_idx.internalPointer() );
}
// return ResourcesItem belonging to a certain index
static inline ResourcesItem * item( const QModelIndex & _idx )
{
return treeItem( _idx )->item();
}
private:
bool filterItems( ResourcesTreeItem * _item,