[partition] Simplify display-role code for bootloader

This commit is contained in:
Adriaan de Groot 2019-03-29 10:54:04 -04:00
parent cbcf85b4a2
commit 17aeaa134a

View File

@ -119,12 +119,12 @@ BootLoaderModel::data( const QModelIndex& index, int role ) const
{ {
if ( role == Qt::DisplayRole ) if ( role == Qt::DisplayRole )
{ {
if ( QStandardItemModel::data( index, BootLoaderModel::BootLoaderPathRole ).toString().isEmpty() ) QString displayRole = QStandardItemModel::data( index, Qt::DisplayRole ).toString();
return QStandardItemModel::data( index, Qt::DisplayRole ).toString(); QString pathRole = QStandardItemModel::data( index, BootLoaderModel::BootLoaderPathRole ).toString();
if ( pathRole.isEmpty() )
return displayRole;
return tr( "%1 (%2)" ) return tr( "%1 (%2)" ).arg( displayRole, pathRole );
.arg( QStandardItemModel::data( index, Qt::DisplayRole ).toString() )
.arg( QStandardItemModel::data( index, BootLoaderModel::BootLoaderPathRole ).toString() );
} }
return QStandardItemModel::data( index, role ); return QStandardItemModel::data( index, role );
} }