Bring back tree view headers

This commit is contained in:
Aurélien Gâteau 2014-07-25 13:13:04 +02:00
parent bf72672cce
commit fb6d80ccb6
3 changed files with 23 additions and 3 deletions

View file

@ -110,6 +110,28 @@ PartitionModel::data( const QModelIndex& index, int role ) const
}
}
QVariant
PartitionModel::headerData( int section, Qt::Orientation orientation, int role ) const
{
if ( role != Qt::DisplayRole )
return QVariant();
switch ( section )
{
case NameColumn:
return tr( "Name" );
case FileSystemColumn:
return tr( "File System" );
case MountPointColumn:
return tr(" Mount Point" );
case SizeColumn:
return tr(" Size" );
default:
cDebug() << "Unknown column" << section;
return QVariant();
}
}
void
PartitionModel::fillPartitionList( PartitionNode* parent )
{

View file

@ -46,6 +46,7 @@ public:
int columnCount( const QModelIndex& parent = QModelIndex() ) const override;
int rowCount( const QModelIndex& parent = QModelIndex() ) const override;
QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const override;
QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
Partition* partitionForIndex( const QModelIndex& index ) const;

View file

@ -72,9 +72,6 @@
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<attribute name="headerStretchLastSection">
<bool>false</bool>
</attribute>