RecentResourceListModel: added item(QModelIndex) method
Added an item(QModelIndex) method to RecentResourceListModel which maps given QModelIndex to source model and returns the according ResourceItem from the source model.
This commit is contained in:
@@ -50,6 +50,8 @@ public:
|
||||
return m_model;
|
||||
}
|
||||
|
||||
ResourceItem * item( const QModelIndex & _idx );
|
||||
|
||||
|
||||
protected:
|
||||
// compares items at two indices by date-property
|
||||
|
||||
@@ -39,7 +39,16 @@ RecentResourceListModel::RecentResourceListModel( ResourceDB * _db,
|
||||
|
||||
|
||||
|
||||
bool RecentResourceListModel::lessThan ( const QModelIndex & _left,
|
||||
|
||||
ResourceItem * RecentResourceListModel::item( const QModelIndex & _idx )
|
||||
{
|
||||
return m_model->item( mapToSource( _idx ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool RecentResourceListModel::lessThan( const QModelIndex & _left,
|
||||
const QModelIndex & _right ) const
|
||||
{
|
||||
return m_model->item( _left )->lastMod() < m_model->item( _right )->lastMod();
|
||||
|
||||
Reference in New Issue
Block a user