PartitionModel: Add getter for Partition
This commit is contained in:
parent
4429a8fd63
commit
2000553a10
@ -82,3 +82,14 @@ PartitionModel::fillPartitionList( PartitionNode* parent )
|
|||||||
fillPartitionList( partition );
|
fillPartitionList( partition );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Partition*
|
||||||
|
PartitionModel::partitionForIndex( const QModelIndex& index ) const
|
||||||
|
{
|
||||||
|
int row = index.row();
|
||||||
|
if ( row < 0 || row >= m_partitionList.count() )
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return m_partitionList.at( row );
|
||||||
|
}
|
||||||
|
@ -33,6 +33,8 @@ public:
|
|||||||
int rowCount( const QModelIndex& parent = QModelIndex() ) const Q_DECL_OVERRIDE;
|
int rowCount( const QModelIndex& parent = QModelIndex() ) const Q_DECL_OVERRIDE;
|
||||||
QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const Q_DECL_OVERRIDE;
|
QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
Partition* partitionForIndex( const QModelIndex& index ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Device* m_device;
|
Device* m_device;
|
||||||
QList< Partition* > m_partitionList;
|
QList< Partition* > m_partitionList;
|
||||||
|
Loading…
Reference in New Issue
Block a user