Resource[Tree]Item: made hidden-flag multi-model capable

The hidden flag has been moved from ResourceTreeItem to ResourceItem
and has been made multi-model capable, i.e. a ResourceModel pointer is
being used for looking up the flag in a hash table.
This commit is contained in:
Tobias Doerffel
2009-08-17 16:50:35 +02:00
parent dfae570700
commit dd42518bb9
3 changed files with 26 additions and 22 deletions

View File

@@ -27,12 +27,13 @@
#include <QtCore/QByteArray>
#include <QtCore/QDateTime>
#include <QtCore/QHash>
#include <QtCore/QList>
#include "ResourceProvider.h"
class ResourceTreeItem;
class ResourceModel;
class ResourceItem
{
@@ -77,6 +78,17 @@ public:
// copy constructor
ResourceItem( const ResourceItem & _item );
inline void setHidden( bool _h, const ResourceModel * _model )
{
m_hidden[_model] = _h;
}
inline bool isHidden( const ResourceModel * _model ) const
{
return m_hidden[_model];
}
const ResourceProvider * provider() const
{
return m_provider;
@@ -230,6 +242,8 @@ private:
QDateTime m_lastMod;
QString m_tags;
QHash<const ResourceModel *, bool> m_hidden;
ResourceTreeItem * m_treeItem;
} ;

View File

@@ -50,21 +50,12 @@ public:
~ResourceTreeItem();
inline void setHidden( bool _h )
{
m_hidden = _h;
}
int rowCount( const ResourceModel * _model = NULL ) const;
inline bool isHidden() const
{
return m_hidden;
}
ResourceTreeItem * getChild( int _row,
const ResourceModel * _model = NULL );
int rowCount() const;
ResourceTreeItem * getChild( int _row );
int row() const;
int row( const ResourceModel * _model = NULL ) const;
inline void addChild( ResourceTreeItem * _it )
{
@@ -127,7 +118,6 @@ private:
ResourceTreeItem * m_parent;
ResourceTreeItemList m_children;
bool m_hidden;
bool m_temporaryMarker;
ResourceItem * m_item;